@@ -2099,38 +2099,31 @@ mod unify {
2099
2099
// we eliminate pushdown. The typechecker should never rely on early
2100
2100
// resolution of type variables.
2101
2101
fn resolve_all_vars ( & ty_ctxt tcx, & @var_bindings vb , t typ ) -> t {
2102
- fn folder ( ty_ctxt tcx, @var_bindings vb , @bool success , t typ ) -> t {
2102
+ if ( !type_contains_vars ( tcx, typ) ) { ret typ; }
2103
+
2104
+ fn folder ( ty_ctxt tcx, @var_bindings vb , t typ ) -> t {
2103
2105
alt ( struct ( tcx, typ) ) {
2104
2106
case ( ty_var ( ?vid) ) {
2105
2107
// It's possible that we haven't even created the var set.
2106
2108
// Handle this case gracefully.
2107
2109
if ( ( vid as uint ) >= ufind:: set_count ( vb. sets ) ) {
2108
- * success = false ; ret typ;
2110
+ ret typ;
2109
2111
}
2110
2112
2111
2113
auto root_id = ufind:: find ( vb. sets , vid as uint ) ;
2112
2114
alt ( smallintmap:: find[ t] ( vb. types , root_id) ) {
2113
2115
case ( some[ t] ( ?typ2) ) {
2114
- ret fold_ty ( tcx, bind folder ( tcx, vb, success, _) ,
2115
- typ2) ;
2116
+ ret fold_ty ( tcx, bind folder ( tcx, vb, _) , typ2) ;
2116
2117
}
2117
- case ( none[ t] ) { * success = false ; ret typ; }
2118
+ case ( none[ t] ) { ret typ; }
2118
2119
}
2119
- log "" ; // fixes ambiguity
2120
- * success = false ; ret typ;
2121
2120
}
2122
2121
2123
2122
case ( _) { ret typ; }
2124
2123
}
2125
2124
}
2126
2125
2127
- auto success = @true ;
2128
- auto rty = fold_ty ( tcx, bind folder ( tcx, vb, success, _) , typ) ;
2129
- /*if (*success) { ret rty; }
2130
- log_err "*** failed! type " + ty::ty_to_str(tcx, typ) + " => " +
2131
- ty::ty_to_str(tcx, rty);
2132
- ret typ;*/
2133
- ret rty;
2126
+ ret fold_ty( tcx, bind folder ( tcx, vb, _) , typ) ;
2134
2127
}
2135
2128
2136
2129
fn unify_step ( & @ctxt cx , & t expected , & t actual ) -> result {
0 commit comments