Skip to content

fix(runtime): expose core intrinsic Symbol.toStringTag descriptors - #10998

Closed
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/10633-core-tostringtag
Closed

proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/10633-core-tostringtag

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #10633.

Map, Set, WeakMap, WeakSet, Promise, ArrayBuffer, and DataView now define the standard own Symbol.toStringTag data property on their prototypes with the expected descriptor flags. Native instances also resolve the inherited property through their actual prototype.

Validation:

  • cargo build --profile perry-dev -p perry -p perry-runtime-static -p perry-stdlib-static
  • cargo fmt --all -- --check
  • scripts/check_file_size.sh
  • ./run_parity_tests.sh --filter test_gap_10633_core_tostringtag (prebuilt compiler/runtime; 1/1 pass)
  • ./run_parity_tests.sh --filter test_gap_10555_symbol_tostringtag_web_builtins (prebuilt compiler/runtime; 1/1 pass)

Summary by CodeRabbit

  • Bug Fixes

    • Improved Symbol.toStringTag behavior for Map, Set, WeakMap, WeakSet, Promise, ArrayBuffer, and DataView instances.
    • Built-in prototypes now expose the appropriate standard string tags through inheritance.
    • Corrected property descriptor behavior, including preventing changes to the built-in Map tag.
  • Tests

    • Added coverage for tag values, string representations, descriptor flags, and protected built-in tag properties.

@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0aaca822-aada-4f3e-8408-8c92a0ac3c3d

📥 Commits

Reviewing files that changed from the base of the PR and between c7cbc3c and ce0d900.

📒 Files selected for processing (4)
  • changelog.d/10998-core-tostringtag.md
  • crates/perry-runtime/src/object/global_this/proto_methods.rs
  • crates/perry-runtime/src/symbol/get.rs
  • test-files/test_gap_10633_core_tostringtag.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The runtime now assigns Symbol.toStringTag properties to core built-in prototypes. Symbol reads can resolve these tags through actual prototypes for pointer-backed instances. Tests cover values, descriptors, and Map.prototype assignment behavior.

Changes

Core Symbol.toStringTag support

Layer / File(s) Summary
Intrinsic prototype tags
crates/perry-runtime/src/object/global_this/proto_methods.rs
Map, Set, WeakMap, WeakSet, ArrayBuffer, DataView, and Promise prototypes receive intrinsic Symbol.toStringTag values.
Reflective tag resolution
crates/perry-runtime/src/symbol/get.rs
The symbol resolver reflects the actual prototype for Symbol.toStringTag reads and returns the prototype tag for pointer-backed instances.
Descriptor and instance validation
test-files/test_gap_10633_core_tostringtag.ts, changelog.d/10998-core-tostringtag.md
Tests check tag values, descriptor flags, instance resolution, and failed Map.prototype assignment. The changelog records the supported built-ins.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Instance
  participant SymbolResolver
  participant BuiltinPrototype
  Instance->>SymbolResolver: Read Symbol.toStringTag
  SymbolResolver->>BuiltinPrototype: Resolve actual prototype
  BuiltinPrototype-->>SymbolResolver: Return intrinsic tag
  SymbolResolver-->>Instance: Return tag value
Loading

Merge Risk: ⚪ Minimal · up to ce0d9

The runtime adds standard Symbol.toStringTag behavior for core built-ins, with no identified merge-blocking impact. Mergeable with normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary runtime change: exposing core intrinsic Symbol.toStringTag descriptors.
Description check ✅ Passed The description explains the change, references issue #10633, and lists concrete validation commands. It does not reproduce the template headings or checklist, but it contains the main required inform…
Linked Issues check ✅ Passed The change satisfies the coding requirements in issue #10633. populate_builtin_prototype_methods installs Symbol.toStringTag on the collection, Promise, ArrayBuffer, and DataView prototypes. The i…
Out of Scope Changes check ✅ Passed The changes remain within the scope of issue #10633. Set, WeakMap, and WeakSet use the same core intrinsic Symbol.toStringTag implementation and extend the requested prototype conformance consistent…
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (1 skipped: 1 u…
✨ Finishing Touches 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed on main in merge train 258 (#11078, v0.5.1641), main e27f0a068a.

Carried at head ce0d900c0d. CI on the train head was fully green — 22 jobs, zero failures, the first train since the public-baseline artifact was regenerated, so no known-red line to read past.

This train was bisect-verified: after an earlier 35-PR assembly hit five gap regressions, the lowering-touching PRs were split into probes, and this set (#11070) came back with all six gap shards clean while the other half reproduced all five.

Trains rebase-merge, so commits get new SHAs and GitHub cannot mark this merged. Closed as landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant