Skip to content

fix(runtime): reject new Symbol and BigInt - #2903

Merged
proggeramlug merged 7 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-2883-nonconstructable-symbol-bigint
May 30, 2026
Merged

fix(runtime): reject new Symbol and BigInt#2903
proggeramlug merged 7 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-2883-nonconstructable-symbol-bigint

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Summary

  • routes direct new Symbol(...) and new BigInt(...) to Node-compatible TypeErrors after evaluating constructor arguments
  • handles globalThis.Symbol / globalThis.BigInt member constructor forms in HIR lowering
  • rejects obvious alias constructor forms through js_new_function_construct instead of returning placeholders or crashing
  • adds focused node-suite parity coverage for callable and constructable forms

Closes #2883

Validation

  • PATH="/root/.npm/_npx/8758e404b5eed2f3/node_modules/.bin:$PATH" node --experimental-strip-types test-parity/node-suite/globals/symbol-bigint-new-throws.ts
  • env RUSTC_WRAPPER= PATH="/root/.npm/_npx/8758e404b5eed2f3/node_modules/.bin:$PATH" ./run_parity_tests.sh --suite node-suite --module globals --filter symbol-bigint-new-throws (test-parity/reports/parity_report_20260530_020504.json)
  • env RUSTC_WRAPPER= cargo check -p perry-hir -p perry-codegen -p perry-runtime
  • cargo fmt --all -- --check
  • git diff --check
  • git diff --cached --check
  • jq empty test-parity/known_failures.json test-parity/threshold.json

Pre-fix focused parity failed and the alias path crashed: test-parity/reports/parity_report_20260530_015442.json.

Note: ./scripts/check_file_size.sh currently fails on crates/perry-runtime/src/node_stream_readwrite.rs at 2001 lines; that file is unchanged by this PR and is already 2001 lines on origin/main.

@proggeramlug
proggeramlug merged commit fabaea2 into PerryTS:main May 30, 2026
11 checks passed
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.

runtime: throw TypeError for new Symbol and new BigInt

2 participants