mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
Fix bug in typechecker counting occurrences of typarams in instantiation rather than checking formals list.
This commit is contained in:
@@ -287,9 +287,9 @@ fn instantiate(tcx: &ty::ctxt, sp: &span, getter: &ty_getter,
|
||||
// TODO: maybe record cname chains so we can do
|
||||
// "foo = int" like OCaml?
|
||||
|
||||
let params_opt_and_ty = getter(id);
|
||||
if ivec::len(params_opt_and_ty.kinds) == 0u {
|
||||
ret params_opt_and_ty.ty;
|
||||
let ty_param_kinds_and_ty = getter(id);
|
||||
if ivec::len(ty_param_kinds_and_ty.kinds) == 0u {
|
||||
ret ty_param_kinds_and_ty.ty;
|
||||
}
|
||||
// The typedef is type-parametric. Do the type substitution.
|
||||
//
|
||||
@@ -299,14 +299,14 @@ fn instantiate(tcx: &ty::ctxt, sp: &span, getter: &ty_getter,
|
||||
param_bindings += ~[ast_ty_to_ty(tcx, getter, ast_ty)];
|
||||
}
|
||||
if ivec::len(param_bindings) !=
|
||||
ty::count_ty_params(tcx, params_opt_and_ty.ty) {
|
||||
ivec::len(ty_param_kinds_and_ty.kinds) {
|
||||
tcx.sess.span_fatal(sp,
|
||||
"Wrong number of type arguments for a \
|
||||
polymorphic tag");
|
||||
polymorphic type");
|
||||
}
|
||||
let typ =
|
||||
ty::substitute_type_params(tcx, param_bindings,
|
||||
params_opt_and_ty.ty);
|
||||
ty_param_kinds_and_ty.ty);
|
||||
ret typ;
|
||||
}
|
||||
let typ;
|
||||
|
||||
Reference in New Issue
Block a user