fix(semantic): report error on for-await inside block inside static block#20749
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR improves JavaScript early-error reporting for class static initialization blocks by ensuring for await (...) is rejected even when it appears inside a nested block within a static { ... }.
Changes:
- Update the semantic check for
for await (...)to detect class static block context via ancestor scopes. - Add a new negative-coverage fixture exercising
for awaitinside a nested block within a class static block. - Update the parser coverage snapshot to include the new failing case.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_semantic/src/checker/javascript.rs | Uses an ancestor-scope helper to correctly flag for await inside nested blocks within static blocks. |
| tasks/coverage/misc/fail/semantic-for-await-in-block-in-static-block.mjs | New negative fixture covering the nested-block-in-static-block for await case. |
| tasks/coverage/snapshots/parser_misc.snap | Snapshot updated to reflect the added negative case and diagnostic output. |
Merge activity
|
d34bf76 to
560a969
Compare
560a969 to
ccf9301
Compare

No description provided.