mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
chore: add do_avoiding_recursion
This commit is contained in:
parent
61fe131adc
commit
28459166bf
3 changed files with 54 additions and 55 deletions
|
@ -470,10 +470,7 @@ impl Context {
|
|||
return self.supertype_of(&t, rhs);
|
||||
}
|
||||
if let Some((_sub, sup)) = lfv.get_subsup() {
|
||||
lhs.undoable_link(rhs);
|
||||
let res = self.supertype_of(&sup, rhs);
|
||||
lfv.undo();
|
||||
res
|
||||
lfv.do_avoiding_recursion_with(rhs, || self.supertype_of(&sup, rhs))
|
||||
} else if let Some(lfvt) = lfv.get_type() {
|
||||
// e.g. lfv: ?L(: Int) is unreachable
|
||||
// but
|
||||
|
@ -493,10 +490,7 @@ impl Context {
|
|||
return self.supertype_of(lhs, &t);
|
||||
}
|
||||
if let Some((sub, _sup)) = rfv.get_subsup() {
|
||||
rhs.undoable_link(lhs);
|
||||
let res = self.supertype_of(lhs, &sub);
|
||||
rfv.undo();
|
||||
res
|
||||
rfv.do_avoiding_recursion_with(lhs, || self.supertype_of(lhs, &sub))
|
||||
} else if let Some(rfvt) = rfv.get_type() {
|
||||
let lhs_meta = self.meta_type(lhs);
|
||||
self.supertype_of(&lhs_meta, &rfvt)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue