mirror of
https://github.com/erg-lang/erg.git
synced 2025-07-24 05:26:24 +00:00
fix: quantified subroutine subtyping bugs
This commit is contained in:
parent
4dcca2b06d
commit
aa2cea60dd
28 changed files with 638 additions and 222 deletions
|
@ -1497,4 +1497,27 @@ impl Context {
|
|||
other => Ok(other),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn instantiate_dummy(&self, quantified: Type) -> Type {
|
||||
match quantified {
|
||||
FreeVar(fv) if fv.is_linked() => self.instantiate_dummy(fv.crack().clone()),
|
||||
Quantified(quant) => {
|
||||
let mut tmp_tv_cache = TyVarCache::new(self.level, self);
|
||||
let ty = self
|
||||
.instantiate_t_inner(*quant, &mut tmp_tv_cache, &())
|
||||
.unwrap();
|
||||
if cfg!(feature = "debug") && ty.has_qvar() {
|
||||
panic!("{ty} has qvar")
|
||||
}
|
||||
ty
|
||||
}
|
||||
Refinement(refine) if refine.t.is_quantified_subr() => {
|
||||
let quant = enum_unwrap!(*refine.t, Type::Quantified);
|
||||
let mut tmp_tv_cache = TyVarCache::new(self.level, self);
|
||||
self.instantiate_t_inner(*quant, &mut tmp_tv_cache, &())
|
||||
.unwrap()
|
||||
}
|
||||
other => unreachable!("{other}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue