Prevent infinite loop unifying variable with itself
This commit is contained in:
parent
09a42340fc
commit
f0e291a84d
1 changed files with 6 additions and 5 deletions
|
|
@ -95,6 +95,7 @@ unifyTerm t1 t2 = do
|
||||||
case (t1', t2') of
|
case (t1', t2') of
|
||||||
(TStat s1, TStat s2) -> unifyStat s1 s2
|
(TStat s1, TStat s2) -> unifyStat s1 s2
|
||||||
(TInt i1, TInt i2) -> guard $ i1 == i2
|
(TInt i1, TInt i2) -> guard $ i1 == i2
|
||||||
|
(TVar v, TVar w) | v == w -> pure ()
|
||||||
(TVar v, t) -> bindTerm v t
|
(TVar v, t) -> bindTerm v t
|
||||||
(t, TVar v) -> bindTerm v t
|
(t, TVar v) -> bindTerm v t
|
||||||
(_, _) -> empty
|
(_, _) -> empty
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue