@@ -2055,34 +2055,33 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr, unify: &unifier,
2055
2055
bot = check_call_or_bind( fcx, expr. span, f, args, kind_bind) ;
2056
2056
2057
2057
// Pull the argument and return types out.
2058
- let proto_1;
2059
- let arg_tys_1: [ ty:: arg] = [ ] ;
2060
- let rt_1;
2061
- let fty = expr_ty( tcx, f) ;
2062
- let t_1;
2063
- alt structure_of( fcx, expr. span, fty) {
2064
- ty:: ty_fn( proto, arg_tys, rt, cf, constrs) {
2065
- proto_1 = proto;
2066
- rt_1 = rt;
2067
- // FIXME:
2068
- // probably need to munge the constrs to drop constraints
2069
- // for any bound args
2058
+ let ( proto, arg_tys, rt, cf, constrs) =
2059
+ alt structure_of( fcx, expr. span, expr_ty( tcx, f) ) {
2060
+ // FIXME:
2061
+ // probably need to munge the constrs to drop constraints
2062
+ // for any bound args
2063
+ ty:: ty_fn( proto, arg_tys, rt, cf, constrs) {
2064
+ ( proto, arg_tys, rt, cf, constrs)
2065
+ }
2066
+ ty:: ty_native_fn( _, arg_tys, rt) {
2067
+ ( ast:: proto_fn, arg_tys, rt, ast:: return, [ ] )
2068
+ }
2069
+ _ { fail "LHS of bind expr didn't have a function type?!" ; }
2070
+ } ;
2070
2071
2071
- // For each blank argument, add the type of that argument
2072
- // to the resulting function type.
2073
- let i = 0 u;
2074
- while i < vec:: len:: < option:: t < @ast:: expr > > ( args ) {
2075
- alt args[ i] {
2076
- some ( _) { /* no-op */ }
2077
- none. { arg_tys_1 += [ arg_tys[ i] ] ; }
2078
- }
2079
- i += 1 u;
2072
+ // For each blank argument, add the type of that argument
2073
+ // to the resulting function type.
2074
+ let out_args = [ ] ;
2075
+ let i = 0 u;
2076
+ while i < vec:: len ( args ) {
2077
+ alt args[ i] {
2078
+ some ( _) { /* no-op */ }
2079
+ none. { out_args += [ arg_tys[ i] ] ; }
2080
2080
}
2081
- t_1 = ty:: mk_fn ( tcx, proto_1, arg_tys_1, rt_1, cf, constrs) ;
2082
- }
2083
- _ { fail "LHS of bind expr didn't have a function type?!" ; }
2081
+ i += 1 u;
2084
2082
}
2085
- write:: ty_only_fixup ( fcx , id , t_1 ) ;
2083
+ let ft = ty:: mk_fn ( tcx, proto, out_args, rt, cf, constrs) ;
2084
+ write:: ty_only_fixup ( fcx, id, ft) ;
2086
2085
}
2087
2086
ast:: expr_call ( f, args) {
2088
2087
bot = check_call_full ( fcx, expr. span , f, args, kind_call, expr. id ) ;
0 commit comments