diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2011-07-29 18:44:47 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2011-07-29 18:48:15 -0700 |
| commit | bc4e9afe2547fa88b55ffc31fef041dffe864b2b (patch) | |
| tree | 8ba244f91f4833b07e2ad9d12e5d3bb8662755b6 /src/comp/middle | |
| parent | 0c9b749d208ccc75f03ab9f7fce1322aa5dbbfd3 (diff) | |
| download | rust-bc4e9afe2547fa88b55ffc31fef041dffe864b2b.tar.gz rust-bc4e9afe2547fa88b55ffc31fef041dffe864b2b.zip | |
Fix bug in typechecker counting occurrences of typarams in instantiation rather than checking formals list.
Diffstat (limited to 'src/comp/middle')
| -rw-r--r-- | src/comp/middle/typeck.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index e6077e2ff0d..b2b49340fb5 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -287,9 +287,9 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> // 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 ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) -> 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; |
