mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-27 19:59:07 +00:00
fix: type variable bug
This commit is contained in:
parent
d230bb7374
commit
afa03ab036
1 changed files with 6 additions and 0 deletions
|
@ -4172,6 +4172,12 @@ impl Type {
|
||||||
Self::FreeVar(fv) if fv.is_linked() => fv.unwrap_linked().eliminate_subsup(target),
|
Self::FreeVar(fv) if fv.is_linked() => fv.unwrap_linked().eliminate_subsup(target),
|
||||||
Self::FreeVar(ref fv) if fv.constraint_is_sandwiched() => {
|
Self::FreeVar(ref fv) if fv.constraint_is_sandwiched() => {
|
||||||
let (sub, sup) = fv.get_subsup().unwrap();
|
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 sub = sub.eliminate_subsup(target);
|
||||||
let sup = sup.eliminate_subsup(target);
|
let sup = sup.eliminate_subsup(target);
|
||||||
self.update_tyvar(sub, sup, None, false);
|
self.update_tyvar(sub, sup, None, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue