From 468786e36d5ab35afb54b60bc1d6147ba0db8733 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 2 Jun 2011 17:48:40 -0700 Subject: [PATCH] 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 --- src/comp/middle/ty.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index f936d7513e5c..5f0c9a90362a 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -981,6 +981,7 @@ fn type_has_pointers(&ctxt cx, &t ty) -> bool { alt (struct(cx, ty)) { // scalar types case (ty_nil) { ret false; } + case (ty_bot) { ret false; } case (ty_bool) { ret false; } case (ty_int) { ret false; } case (ty_float) { ret false; } @@ -2049,7 +2050,7 @@ mod unify { result_mode = expected_input.mode; } - auto result = unify_step(cx, actual_input.ty, expected_input.ty); + auto result = unify_step(cx, expected_input.ty, actual_input.ty); alt (result) { case (ures_ok(?rty)) {