Skip to content

Commit

Permalink
fix: type variable bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Oct 3, 2024
1 parent d230bb7 commit afa03ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/erg_compiler/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4172,6 +4172,12 @@ impl Type {
Self::FreeVar(fv) if fv.is_linked() => fv.unwrap_linked().eliminate_subsup(target),
Self::FreeVar(ref fv) if fv.constraint_is_sandwiched() => {
let (sub, sup) = fv.get_subsup().unwrap();
let sub = if sub.addr_eq(target) {
Type::Never
} else {
sub
};
let sup = if sup.addr_eq(target) { Type::Obj } else { sup };
let sub = sub.eliminate_subsup(target);
let sup = sup.eliminate_subsup(target);
self.update_tyvar(sub, sup, None, false);
Expand Down

0 comments on commit afa03ab

Please sign in to comment.