aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2010-10-22 15:10:48 -0700
committerPatrick Walton <[email protected]>2010-10-22 15:12:48 -0700
commitfc8b5155a87b5a9ae2313f7282cab9893f4b9f3e (patch)
treecbe23737b6920e1f0f33e29ba5cf81d4115e52bd /src
parentAdd makefile bits to run rustc on the testsuite as part of 'make check'. Most... (diff)
downloadrust-fc8b5155a87b5a9ae2313f7282cab9893f4b9f3e.tar.xz
rust-fc8b5155a87b5a9ae2313f7282cab9893f4b9f3e.zip
rustboot: If the user tries to instantiate a non-parametric type with type parameters, report the location of the error
Diffstat (limited to 'src')
-rw-r--r--src/boot/me/resolve.ml6
-rw-r--r--src/boot/me/semant.ml3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/boot/me/resolve.ml b/src/boot/me/resolve.ml
index 4fafa05f..7cc3e48c 100644
--- a/src/boot/me/resolve.ml
+++ b/src/boot/me/resolve.ml
@@ -324,7 +324,11 @@ let rec lookup_type_by_name
log cx "args: %s"
(Fmt.fmt_to_str Ast.fmt_app_args args);
end;
- let ty = rebuild_ty_under_params cx None ty params args true in
+ let ty =
+ rebuild_ty_under_params
+ ~node_id:(id_of_scope (List.hd scopes))
+ cx None ty params args true
+ in
iflog cx (fun _ -> log cx "--- lookup_type_by_name %a ==> %a"
Ast.sprintf_name name
Ast.sprintf_ty ty);
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml
index 4f278d12..63b52445 100644
--- a/src/boot/me/semant.ml
+++ b/src/boot/me/semant.ml
@@ -1043,6 +1043,7 @@ let rec pretty_ty_str (cx:ctxt) (fallback:(Ast.ty -> string)) (ty:Ast.ty) =
;;
let rec rebuild_ty_under_params
+ ?node_id:id_opt
(cx:ctxt)
(src_tag:Ast.ty_tag option)
(ty:Ast.ty)
@@ -1052,7 +1053,7 @@ let rec rebuild_ty_under_params
: Ast.ty =
if (Array.length params) <> (Array.length args)
then
- err None
+ err id_opt
"mismatched type-params: %s has %d param(s) but %d given"
(pretty_ty_str cx (Ast.sprintf_ty ()) ty)
(Array.length params)