Files
scriptc/packages/runtime
Chris Tate 84b3d1f475 Warn for NaN dynamic and optional element delays and throw on BigInt delays
A delay read through bracket access skipped TimeoutNaNWarning, so that an
element read past the end, undefined in Node and NaN here, warns nothing.
That only holds for a delay typed number: an untyped (checked-dynamic)
delay tests undefined before it converts, and a `number | undefined`
delay warns only in its defined arm, so a NaN in either now warns, as
Node's Timeout constructor does.

An untyped delay converted with Number(), so a BigInt delay scheduled a
timer. It now converts as Node's `after *= 1` does, which throws
"Cannot mix BigInt and other types, use explicit conversions" from
setTimeout and setInterval. setTimeout and setInterval called as stored
function values convert their delay the same way, and now also emit the
Timeout warnings.

Corpus timers-untyped-delay-reads.cjs (BigInt delays, direct and through
function values; NaN and past-the-end element reads of an untyped array;
a negative delay through a stored setTimeout) and
timers-optional-delay-reads.ts (number | undefined element reads).

timer-delay-lowering.test.ts pinned the delay as the plain number the
call reads; it now expects the timers.userDelay check around a number
variable and around the defined arm of a `number | undefined` delay.
2026-10-30 10:32:40 -05:00
..
2026-07-22 18:08:04 -05:00
2026-10-29 06:02:00 -05:00