aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/ty.rs15
-rw-r--r--src/comp/middle/typeck.rs6
2 files changed, 11 insertions, 10 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 9e90d125..4a630af1 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -2098,14 +2098,17 @@ mod Unify {
auto expected_input = expected_inputs.(i);
auto actual_input = actual_inputs.(i);
- // This should be safe, I think?
- // FIXME: It's not. At all.
+ // Unify the result modes. "mo_either" unifies with both modes.
auto result_mode;
- if (expected_input.mode == mo_alias ||
- actual_input.mode == mo_alias) {
- result_mode = mo_alias;
+ if (expected_input.mode == mo_either) {
+ result_mode = actual_input.mode;
+ } else if (actual_input.mode == mo_either) {
+ result_mode = expected_input.mode;
+ } else if (expected_input.mode != actual_input.mode) {
+ ret fn_common_res_err(ures_err(terr_arg_count,
+ expected, actual));
} else {
- result_mode = mo_val;
+ result_mode = expected_input.mode;
}
auto result = unify_step(cx, actual_input.ty, expected_input.ty);
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index aeb5f8a2..cdee187d 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -1766,17 +1766,15 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
auto a_0 = check_expr(fcx, a);
args_0 += vec(some[@ast.expr](a_0));
- // FIXME: this breaks aliases. We need a ty_fn_arg.
- auto arg_ty = rec(mode=mo_val,
+ auto arg_ty = rec(mode=mo_either,
ty=expr_ty(fcx.ccx.tcx, a_0));
Vec.push[arg](arg_tys_0, arg_ty);
}
case (none[@ast.expr]) {
args_0 += vec(none[@ast.expr]);
- // FIXME: breaks aliases too?
auto typ = next_ty_var(fcx.ccx);
- Vec.push[arg](arg_tys_0, rec(mode=mo_val, ty=typ));
+ Vec.push[arg](arg_tys_0, rec(mode=mo_either, ty=typ));
}
}
}