Skip to content

Commit c209eca

Browse files
committed
---
yaml --- r: 3794 b: refs/heads/master c: 5f544b1 h: refs/heads/master v: v3
1 parent c487f0e commit c209eca

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 86ee3454a1e49b0b913f37c2c52e79d68cae5410
2+
refs/heads/master: 5f544b1366071a589e758ee73b5fd4c45db52a19

trunk/src/comp/middle/typeck.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,20 @@ fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
159159
auto ty_substs_opt;
160160
auto ty_substs_len = ivec::len[@ast::ty](pth.node.types);
161161
if (ty_substs_len > 0u) {
162+
auto param_var_len = ivec::len(ty_param_vars);
163+
if (param_var_len == 0u) {
164+
fcx.ccx.tcx.sess.span_fatal
165+
(sp, "this item does not take type parameters");
166+
} else if (ty_substs_len > param_var_len) {
167+
fcx.ccx.tcx.sess.span_fatal
168+
(sp, "too many type parameter provided for this item");
169+
} else if (ty_substs_len < param_var_len) {
170+
fcx.ccx.tcx.sess.span_fatal
171+
(sp, "not enough type parameters provided for this item");
172+
}
162173
let ty::t[] ty_substs = ~[];
163174
auto i = 0u;
164175
while (i < ty_substs_len) {
165-
// TODO: Report an error if the number of type params in the item
166-
// and the supplied number of type params don't match.
167-
168176
auto ty_var = ty::mk_var(fcx.ccx.tcx, ty_param_vars.(i));
169177
auto ty_subst = ast_ty_to_ty_crate(fcx.ccx, pth.node.types.(i));
170178
auto res_ty = demand::simple(fcx, pth.span, ty_var, ty_subst);

0 commit comments

Comments
 (0)