Accept n+ as array lengths (#7212)

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-05-28 07:55:28 +12:00
committed by GitHub
parent dba0173cc3
commit 77730196ae
10 changed files with 42 additions and 31 deletions

View File

@ -796,7 +796,7 @@ fn coerce_result_type(
// can be removed.
// I believe this is safe, since anywhere which requires an array should coerce the singleton
// to an array and we only do this hack for return values.
if let RuntimeType::Array(inner, ArrayLen::NonEmpty) = &ty {
if let RuntimeType::Array(inner, ArrayLen::Minimum(1)) = &ty {
ty = RuntimeType::Union(vec![(**inner).clone(), ty]);
}
let val = val.coerce(&ty, true, exec_state).map_err(|_| {