From c9cbf6972bf37881c304ea109b07bc1d94310606 Mon Sep 17 00:00:00 2001 From: Shunsuke Shibayama Date: Tue, 17 Sep 2024 17:31:26 +0900 Subject: [PATCH] fix: sub-unification bug --- crates/erg_compiler/context/unify.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/erg_compiler/context/unify.rs b/crates/erg_compiler/context/unify.rs index 8a7c60915..fea7e0dcc 100644 --- a/crates/erg_compiler/context/unify.rs +++ b/crates/erg_compiler/context/unify.rs @@ -1298,6 +1298,7 @@ impl<'c, 'l, 'u, L: Locational> Unifier<'c, 'l, 'u, L> { // self.sub_unify(&lsub, &union, loc, param_name)?; maybe_sup.update_tyvar(union, intersec, self.undoable, false); } + // TODO: Preferentially compare same-structure types (e.g. K(?T) <: K(?U)) (And(ltys), And(rtys)) => { let mut ltys_ = ltys.clone(); let mut rtys_ = rtys.clone(); @@ -1322,6 +1323,7 @@ impl<'c, 'l, 'u, L: Locational> Unifier<'c, 'l, 'u, L> { } } } + // TODO: Preferentially compare same-structure types (e.g. K(?T) <: K(?U)) // Nat or Str or NoneType <: NoneType or ?T or Int // => Str <: ?T // (Int or ?T) <: (?U or Int)