Repository navigation
fix(hir): keep the Symbol.iterator vtable entry alongside #9226's own-key registration #9372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| **fix(hir): keep the `Symbol.iterator` vtable entry alongside #9226's own-key registration** | ||
|
|
||
| `const R = class { *[Symbol.iterator]() { … } }` threw | ||
| `TypeError: value is not iterable`. | ||
|
|
||
| #9226 replaced `methods.push(wrapper)` with `computed_members.push(…)` in both | ||
| the class-declaration and class-expression paths. Those are not equivalent: the | ||
| first installs an instance **vtable** entry, the second registers a **prototype | ||
| own key**. `synthesize_symbol_iterator_wrapper` exists specifically to provide | ||
| the vtable entry (#5128) — without it the class carries no `@@iterator`, so the | ||
| runtime's class-registry lookup finds nothing. | ||
|
|
||
| Both registrations are required and the fix does both, so #9226's own-key | ||
| enumeration is preserved rather than traded away. | ||
|
|
||
| Verified by bisect on an isolated host (dev profile, same toolchain): | ||
|
|
||
| | commit | `issue_5128_user_symbol_iterator` | | ||
| |---|---| | ||
| | `015ec5fe1c` (parent) | 3 passed | | ||
| | `8b2cfe6e7b` (#9226) | 2 passed, **1 failed** | | ||
| | `8b2cfe6e7b` + this fix | **3 passed** | | ||
|
|
||
| and #9226's own gap test (`test_gap_9226_class_prototype_own_keys.ts`) still | ||
| matches Node byte-for-byte with the fix applied — the own-key win is intact. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Avoid the MD018 lint warning.
Line 6 starts with
#9226, somarkdownlint-cli2parses it as an ATX heading without a space. Rewrite it asIssue#9226`` or escape the hash.Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 6-6: No space after hash on atx style heading
(MD018, no-missing-space-atx)
🤖 Prompt for AI Agents
Source: Linters/SAST tools