Skip to content

fix(timers): global setImmediate/clearImmediate calls + timer typeof === 'function' (#1454)#1455

Merged
proggeramlug merged 1 commit into
mainfrom
fix/global-timer-typeof-1454
May 23, 2026
Merged

fix(timers): global setImmediate/clearImmediate calls + timer typeof === 'function' (#1454)#1455
proggeramlug merged 1 commit into
mainfrom
fix/global-timer-typeof-1454

Conversation

@proggeramlug
Copy link
Copy Markdown
Contributor

Summary

Two related global-timer gaps (#1454):

  1. setImmediate/clearImmediate bare calls threw value is not a function — they weren't in is_builtin_function, so they lowered to a GlobalGet call instead of an ExternFuncRef (which hits the codegen fast path). Added both; setImmediate already had a codegen call arm, added a clearImmediate arm routing to js_clear_timeout_value (immediates share the timer pool).
  2. typeof setTimeout (etc.) read "boolean" — bare timer builtins lower to an ExternFuncRef whose typeof is wrong. Fold typeof of setTimeout/setInterval/setImmediate/clearTimeout/clearInterval/clearImmediate (+ fetch) to "function". gc is excluded (it's undefined in Node without --expose-gc).

Test

  • Flips node-suite/timers/object/dispose to PASS (the setImmediate half, on top of feat(timers): Symbol.dispose on Timeout/Immediate handles (#1213) #1453's Symbol.dispose).
  • New fixture node-suite/timers/global-functionstypeof of all six + setImmediate/clearImmediate call/clear — matches Node.
  • Regression-checked: typeof fetch === "function", setTimeout(...) calls, and test_parity_timers/test_parity_timers_promises all still pass.

Closes #1454.

…=== 'function' (#1454)

setImmediate/clearImmediate weren't recognized as builtin globals, so bare
calls lowered to GlobalGet → 'value is not a function'. Add them to
is_builtin_function (setImmediate already had a codegen call arm; add a
clearImmediate arm routing to js_clear_timeout_value — immediates share the
timer pool). And typeof of the global timer builtins read 'boolean' (they
lower to ExternFuncRef); fold typeof of setTimeout/setInterval/setImmediate/
clearTimeout/clearInterval/clearImmediate (+fetch) to 'function' — gc excluded
(undefined in Node without --expose-gc).

Flips node-suite/timers/object/dispose (the setImmediate half, on top of
#1453's Symbol.dispose) and adds timers/global-functions. Verified typeof
fetch + setTimeout call unaffected.
@proggeramlug proggeramlug force-pushed the fix/global-timer-typeof-1454 branch from 2a0b3ad to 2dc3241 Compare May 23, 2026 04:32
@proggeramlug proggeramlug merged commit 5c9b2fc into main May 23, 2026
9 checks passed
@proggeramlug proggeramlug deleted the fix/global-timer-typeof-1454 branch May 23, 2026 04:38
proggeramlug added a commit that referenced this pull request May 23, 2026
…es (#1458)

Rolls up 22 PRs that merged to main post-v0.5.1025 without per-PR
version bumps.

- node:timers epic (#1213, 6 PRs #1449-#1455): node:timers/promises
  setTimeout/setImmediate, numeric-id clear*, namespace import, ref()
  typeof, Symbol.dispose, global setImmediate/clearImmediate.
- node:perf_hooks fan-out (10 PRs across #1320 #1327 #1337-#1340
  #1388-#1390 #1403): typeof methods, performance singleton identity,
  nodeTiming, toJSON, clearResourceTimings, structured-clone detail,
  observer arg + buffered + throw cases.
- node:json lazy-tape closes #1424 (#1447) — JSON.parse reviver on
  lazy-tape arrays no longer SIGSEGVs (test un-skip-listed).
- #1448 console.log/util.inspect on lazy-tape arrays materialises
  before formatting.
- #1429 GC unsafe-zone guards for fastify/hyper handlers.
- #1341 codegen: Any-typed .includes()/.indexOf() dynamic dispatch.
- #1370 perry/ui web driver debug noise dropped.

#1423 (AsyncLocalStorage .enterWith/.exit) remains skip-listed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:timers — global setTimeout/setInterval/setImmediate read as typeof 'boolean'/'object' (not 'function')

1 participant