Merge pull request #518 from erg-lang/fix_inf_rec

Fix infinite recursion bugs
This commit is contained in:
Shunsuke Shibayama 2024-09-01 18:23:58 +09:00 committed by GitHub
commit b5092e7890
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1886 additions and 535 deletions

View file

@ -348,8 +348,7 @@ pub(crate) fn __dict_getitem__(mut args: ValueArgs, ctx: &Context) -> EvalValueR
Ok(v.into())
} else {
let index = if let ValueObj::Type(t) = &index {
let derefed = ctx.coerce(t.typ().clone(), &()).unwrap_or(t.typ().clone());
ValueObj::builtin_type(derefed)
ValueObj::builtin_type(ctx.readable_type(t.typ().clone()))
} else {
index
};