Unify var-const

This commit is contained in:
greg 2019-02-23 01:18:15 -08:00
parent be175a2b75
commit 452f2ab188
1 changed files with 2 additions and 1 deletions

View File

@ -359,7 +359,8 @@ impl<'a> TypeContext<'a> {
match (t1, t2) {
(Const(ref c1), Const(ref c2)) if c1 == c2 => Ok(Const(c1.clone())), //choice of c1 is arbitrary I *think*
(Const(ref c1), Var(ref v2)) => {
//TODO flesh this out!
self.unification_table.unify_var_value(v2.clone(), Some(c1.clone()))
.or_else(|_| TypeError::new(format!("Couldn't unify {:?} and {:?}", Const(c1.clone()), Var(*v2))))?;
Ok(Const(c1.clone()))
},
(a @ Var(_), b @ Const(_)) => self.unify(b, a),