rustboot: If the user tries to instantiate a non-parametric type with type parameters, report the location of the error
This commit is contained in:
parent
6ec402d4a6
commit
fc8b5155a8
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user