From b1fcd84ebae4029ea8ceaab2bad47785a56ed01b Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Sun, 4 Sep 2016 18:15:20 +1000 Subject: [PATCH] Add hole cases to unification --- check/src/unify_type.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/check/src/unify_type.rs b/check/src/unify_type.rs index c186e2e7b0..b37f009eb2 100644 --- a/check/src/unify_type.rs +++ b/check/src/unify_type.rs @@ -425,6 +425,9 @@ impl<'a, 'e> Unifier, ArcType> for Merge<'e> { // `l` and `r` must have the same type, if one is a variable that variable is // unified with whatever the other type is let result = match (&**l, &**r) { + (&Type::Hole, &Type::Hole) => Ok(Some(subs.new_var())), + (_, &Type::Hole) => Ok(Some(l.clone())), + (&Type::Hole, _) => Ok(Some(r.clone())), (&Type::Variable(ref l), &Type::Variable(ref r)) if l.id == r.id => Ok(None), (&Type::Generic(ref l_gen), &Type::Variable(ref r_var)) => { let left = match unifier.unifier.variables.get(&l_gen.id) {