diff --git a/crates/erg_compiler/context/unify.rs b/crates/erg_compiler/context/unify.rs index 39db7936f..9e3e68829 100644 --- a/crates/erg_compiler/context/unify.rs +++ b/crates/erg_compiler/context/unify.rs @@ -193,10 +193,10 @@ impl<'c, 'l, 'u, L: Locational> Unifier<'c, 'l, 'u, L> { // self.occur_inner(&sup_t, maybe_sup) })?; } - if let Some((_sub_t, sup_t)) = sup.get_subsup() { + if let Some((sub_t, sup_t)) = sup.get_subsup() { sup.do_avoiding_recursion(|| { // occur(?U, ?T(:> ?U or Y)) ==> OK - // self.occur_inner(maybe_sub, &sub_t)?; + self.occur_inner(maybe_sub, &sub_t)?; self.occur_inner(maybe_sub, &sup_t) })?; } diff --git a/crates/erg_compiler/tests/infer.er b/crates/erg_compiler/tests/infer.er index e4b4b749a..a4bcf1406 100644 --- a/crates/erg_compiler/tests/infer.er +++ b/crates/erg_compiler/tests/infer.er @@ -48,3 +48,10 @@ ff! x: Str or NoneType = do!: f0!() f0!() = print! "" f1! _: Str = f0!() + +arr = [1] +for! arr, (_,) => + if! True, do!: + if! True, do!: + if! True, do!: + todo()