@@ -1167,17 +1167,11 @@ mod writeback {
1167
1167
fn visit_item ( item : & @ast:: item , wbcx : & wb_ctxt , v : & wb_vt ) {
1168
1168
// Ignore items
1169
1169
}
1170
- fn visit_fn ( f : & ast:: _fn , tps : & ast:: ty_param [ ] ,
1171
- sp : & span , i : & ast:: fn_ident , d : ast:: node_id ,
1172
- wbcx : & wb_ctxt , v : & wb_vt ) {
1173
- // Ignore fns
1174
- }
1175
1170
1176
1171
fn resolve_type_vars_in_block ( fcx : & @fn_ctxt , blk : & ast:: blk ) -> bool {
1177
1172
let wbcx = { fcx: fcx, mutable success: true } ;
1178
1173
let visit = visit:: mk_vt
1179
1174
( @{ visit_item: visit_item,
1180
- visit_fn: visit_fn,
1181
1175
visit_stmt: visit_stmt,
1182
1176
visit_expr: visit_expr,
1183
1177
visit_block: visit_block,
@@ -2647,7 +2641,6 @@ fn check_fn(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
2647
2641
check_block ( fcx, body) ;
2648
2642
alt decl. purity {
2649
2643
ast:: pure_fn. {
2650
-
2651
2644
// This just checks that the declared type is bool, and trusts
2652
2645
// that that's the actual return type.
2653
2646
if !ty:: type_is_bool ( ccx. tcx , fcx. ret_ty ) {
@@ -2669,7 +2662,13 @@ fn check_fn(ccx: &@crate_ctxt, f: &ast::_fn, id: &ast::node_id,
2669
2662
}
2670
2663
}
2671
2664
2672
- writeback:: resolve_type_vars_in_block ( fcx, body) ;
2665
+ // If we don't have any enclosing function scope, it is time to
2666
+ // force any remaining type vars to be resolved.
2667
+ // If we have an enclosing function scope, our type variables will be
2668
+ // resolved when the enclosing scope finishes up.
2669
+ if ( option:: is_none ( old_fcx) ) {
2670
+ writeback:: resolve_type_vars_in_block ( fcx, body) ;
2671
+ }
2673
2672
}
2674
2673
2675
2674
fn check_method ( ccx : & @crate_ctxt , method : & @ast:: method ) {
0 commit comments