Unify var-var
This commit is contained in:
parent
452f2ab188
commit
2cc3367666
@ -365,7 +365,9 @@ impl<'a> TypeContext<'a> {
|
|||||||
},
|
},
|
||||||
(a @ Var(_), b @ Const(_)) => self.unify(b, a),
|
(a @ Var(_), b @ Const(_)) => self.unify(b, a),
|
||||||
(Var(v1), Var(v2)) => {
|
(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)),
|
(a, b) => TypeError::new(format!("{:?} and {:?} do not unify", a, b)),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user