Skip to content

Commit

Permalink
Add hole cases to unification
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanzab committed Sep 4, 2016
1 parent eb6ca0f commit b1fcd84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions check/src/unify_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ impl<'a, 'e> Unifier<State<'a>, 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) {
Expand Down

0 comments on commit b1fcd84

Please sign in to comment.