@@ -692,7 +692,8 @@ mod collect {
692
692
let ty = ty:: method_ty_to_fn_ty (
693
693
cx. tcx , ty_of_method ( cx. tcx , m_collect, m) ) ;
694
694
cx. tcx . tcache . insert ( local_def ( m. node . id ) ,
695
- { kinds: [ ] , ty: ty} ) ;
695
+ { kinds: ty_param_kinds ( m. node . tps ) ,
696
+ ty: ty} ) ;
696
697
write:: ty_only ( cx. tcx , m. node . id , ty) ;
697
698
}
698
699
write:: ty_only ( cx. tcx , it. id , ast_ty_to_ty ( cx. tcx , m_collect,
@@ -2174,12 +2175,19 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
2174
2175
}
2175
2176
}
2176
2177
} else { csearch:: get_type ( tcx, method. did ) . ty } ;
2177
- let ids = ids;
2178
- if method. n_tps > 0 u {
2178
+ let tvars = vec:: map ( ids, { |id| ty:: mk_var ( tcx, id) } ) ;
2179
+ let n_tps = vec:: len ( ids) ;
2180
+ if method. n_tps + n_tps > 0 u {
2179
2181
let b = bind_params_in_type ( expr. span , tcx,
2180
- bind next_ty_var_id ( fcx) ,
2181
- fty, method. n_tps ) ;
2182
- ids += b. ids ;
2182
+ bind next_ty_var_id ( fcx) , fty,
2183
+ n_tps + method. n_tps ) ;
2184
+ let _tvars = vec:: map ( b. ids , { |id| ty:: mk_var ( tcx, id) } ) ;
2185
+ let i = 0 ;
2186
+ for v in tvars {
2187
+ demand:: simple ( fcx, expr. span , v, _tvars[ i] ) ;
2188
+ i += 1 ;
2189
+ }
2190
+ tvars = _tvars;
2183
2191
fty = b. ty ;
2184
2192
if n_tys > 0 u {
2185
2193
if n_tys != method. n_tps {
@@ -2190,7 +2198,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
2190
2198
}
2191
2199
let i = 0 u;
2192
2200
for ty in tys {
2193
- let tvar = ty :: mk_var ( fcx . ccx . tcx , b . ids [ i ] ) ;
2201
+ let tvar = tvars [ i + n_tps ] ;
2194
2202
let t_subst = ast_ty_to_ty_crate ( fcx. ccx , ty) ;
2195
2203
demand:: simple ( fcx, expr. span , tvar, t_subst) ;
2196
2204
i += 1 u;
@@ -2201,8 +2209,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt, expr: @ast::expr, unify: unifier,
2201
2209
"this method does not take type \
2202
2210
parameters") ;
2203
2211
}
2204
- let substs = vec:: map ( ids, { |id| ty:: mk_var ( tcx, id) } ) ;
2205
- write:: ty_fixup ( fcx, id, { substs : some( substs) , ty: fty} ) ;
2212
+ write:: ty_fixup ( fcx, id, { substs : some( tvars) , ty: fty} ) ;
2206
2213
fcx. ccx . method_map . insert ( id, method. did ) ;
2207
2214
}
2208
2215
none. {
0 commit comments