mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 12:24:45 +00:00
Fix inferring bug
This commit is contained in:
parent
d0fa924ea8
commit
7776297de2
2 changed files with 37 additions and 23 deletions
|
@ -919,6 +919,19 @@ impl Context {
|
|||
if sub == Type::Never {
|
||||
return Ok(proj(lhs, rhs));
|
||||
}
|
||||
// in Methods
|
||||
if self.name == sub.qual_name() {
|
||||
if let Ok(obj) = self.get_const_local(&Token::symbol(&rhs), &self.name) {
|
||||
if let ValueObj::Type(quant_t) = obj {
|
||||
let subst_ctx = SubstContext::new(&sub, self, t_loc);
|
||||
let t = subst_ctx.substitute(quant_t.typ().clone())?;
|
||||
let t = self.eval_t_params(t, level, t_loc)?;
|
||||
return Ok(t);
|
||||
} else {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
}
|
||||
for ty_ctx in self.get_nominal_super_type_ctxs(&sub).ok_or_else(|| {
|
||||
EvalError::no_var_error(
|
||||
self.cfg.input.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue