mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix: refinement subtyping bug
This commit is contained in:
parent
278039c75b
commit
b45041e926
2 changed files with 41 additions and 15 deletions
|
@ -912,22 +912,20 @@ impl Context {
|
|||
}
|
||||
|
||||
fn poly_class_trait_impl_exists(&self, class: &Type, trait_: &Type) -> bool {
|
||||
let mut super_exists = false;
|
||||
for imp in self.get_trait_impls(trait_).into_iter() {
|
||||
self.substitute_typarams(&imp.sub_type, class).unwrap_or(());
|
||||
self.substitute_typarams(&imp.sup_trait, trait_)
|
||||
.unwrap_or(());
|
||||
if self.supertype_of(&imp.sub_type, class) && self.supertype_of(&imp.sup_trait, trait_)
|
||||
{
|
||||
super_exists = true;
|
||||
Self::undo_substitute_typarams(&imp.sub_type);
|
||||
Self::undo_substitute_typarams(&imp.sup_trait);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
Self::undo_substitute_typarams(&imp.sub_type);
|
||||
Self::undo_substitute_typarams(&imp.sup_trait);
|
||||
}
|
||||
super_exists
|
||||
false
|
||||
}
|
||||
|
||||
fn check_trait_impl(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue