fix: infinite recursion bug

This commit is contained in:
Shunsuke Shibayama 2024-09-14 21:10:06 +09:00
parent 9f789199b9
commit 82bc710827
6 changed files with 223 additions and 7 deletions

View file

@ -492,6 +492,10 @@ pub(crate) fn list_union(mut args: ValueArgs, ctx: &Context) -> EvalValueResult<
.iter()
.flat_map(|t| ctx.convert_value_into_type(t.clone()))
.collect::<Vec<_>>();
// args must already be evaluated
if slf.iter().any(|t| t.has_proj() || t.has_proj_call()) {
return Ok(TyParam::t(Type::Obj));
}
let union = slf
.iter()
.fold(Type::Never, |union, t| ctx.union(&union, t));