From d962e2c27a614785df6d8aeda9c13c5041abfe32 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 11 Oct 2017 02:03:50 -0700 Subject: [PATCH] Unify work --- src/schala_lang/type_check.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/schala_lang/type_check.rs b/src/schala_lang/type_check.rs index 7e4b49c..ed40dcf 100644 --- a/src/schala_lang/type_check.rs +++ b/src/schala_lang/type_check.rs @@ -345,6 +345,11 @@ impl TypeContext { match (&t1, &t2) { (&TConst(ref c1), &TConst(ref c2)) if c1 == c2 => Ok(TConst(c1.clone())), + (&TFunc(ref t1, ref t2), &TFunc(ref t3, ref t4)) => { + let t5 = self.unify(*t1.clone().clone(), *t3.clone().clone())?; + let t6 = self.unify(*t2.clone().clone(), *t4.clone().clone())?; + Ok(TFunc(Box::new(t5), Box::new(t6))) + }, _ => Err(format!("Types {:?} and {:?} don't unify", t1, t2)) } }