From 0ce9a1a7729a4477e45ea88aa9e0c86f0df5939d Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Thu, 26 Sep 2024 12:12:51 +0900 Subject: [PATCH] fix: sub-unification bug --- crates/erg_compiler/context/unify.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/erg_compiler/context/unify.rs b/crates/erg_compiler/context/unify.rs index 06c01fccd..f1baec45a 100644 --- a/crates/erg_compiler/context/unify.rs +++ b/crates/erg_compiler/context/unify.rs @@ -1389,7 +1389,10 @@ impl<'c, 'l, 'u, L: Locational> Unifier<'c, 'l, 'u, L> { self.sub_unify(maybe_sub, &sup)?; } let mut new_sub = self.ctx.union(maybe_sub, &sub); - if maybe_sub.qual_name() == sub.qual_name() && new_sub.has_unbound_var() { + if !sub.is_recursive() + && maybe_sub.qual_name() == sub.qual_name() + && new_sub.has_unbound_var() + { let list = UndoableLinkedList::new(); if self .ctx