From 452f2ab18827c3fc359613eb87d0936f42ee15e9 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 23 Feb 2019 01:18:15 -0800 Subject: [PATCH] Unify var-const --- schala-lang/language/src/typechecking.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 14c70a9..5d0a5e8 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -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),