From 2cc33676661a71adf797cea5b18fc8fbea736719 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 23 Feb 2019 01:20:19 -0800 Subject: [PATCH] Unify var-var --- schala-lang/language/src/typechecking.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 5d0a5e8..bbf134f 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -365,7 +365,9 @@ impl<'a> TypeContext<'a> { }, (a @ Var(_), b @ Const(_)) => self.unify(b, a), (Var(v1), Var(v2)) => { - panic!() + self.unification_table.unify_var_var(v1.clone(), v2.clone()) + .or_else(|_| TypeError::new(format!("Two type variables {:?} and {:?} couldn't unify", v1, v2)))?; + Ok(Var(v1.clone())) //arbitrary decision I think }, (a, b) => TypeError::new(format!("{:?} and {:?} do not unify", a, b)), }