Skip to content

Commit 468786e

Browse files
committed
Fix unification bug
Hello from SFO Terminal 3! unify_fn_common had the expected and actual types reversed in one place. This was causing the type of an occurence of a function f with type fn(int) -> T to be set to fn(_|_) -> T at a call site like f(fail); I think this was also making some of the type error messages come out backwards, but I haven't checked. Also: ty_bot does not contain pointers
1 parent c515ed1 commit 468786e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/comp/middle/ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,7 @@ fn type_has_pointers(&ctxt cx, &t ty) -> bool {
981981
alt (struct(cx, ty)) {
982982
// scalar types
983983
case (ty_nil) { ret false; }
984+
case (ty_bot) { ret false; }
984985
case (ty_bool) { ret false; }
985986
case (ty_int) { ret false; }
986987
case (ty_float) { ret false; }
@@ -2049,7 +2050,7 @@ mod unify {
20492050
result_mode = expected_input.mode;
20502051
}
20512052

2052-
auto result = unify_step(cx, actual_input.ty, expected_input.ty);
2053+
auto result = unify_step(cx, expected_input.ty, actual_input.ty);
20532054

20542055
alt (result) {
20552056
case (ures_ok(?rty)) {

0 commit comments

Comments
 (0)