fix(semantic): report error on await inside block inside static block#20750
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. |
There was a problem hiding this comment.
Pull request overview
This PR ensures await inside a nested {} block within a class static { ... } initialization block is correctly reported as an error during semantic checking, and updates coverage artifacts accordingly.
Changes:
- Update
check_await_expressionto detect being inside a class static block via ancestor scope traversal (not just the current scope). - Add a new negative coverage fixture for
awaitinside a nested block within a class static block. - Update the
parser_miscsnapshot to include the new expected diagnostic and increment negative test counts.
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tasks/coverage/snapshots/parser_misc.snap | Adds expected diagnostic output for the new negative case and updates summary counts. |
| tasks/coverage/misc/fail/await-expr-in-block-in-class-static-block.mjs | New negative fixture exercising await in a nested block inside static {}. |
| crates/oxc_semantic/src/checker/javascript.rs | Makes class-static-block detection robust for await by walking scope ancestors. |
081f24e to
a803813
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
a803813 to
aa0f825
Compare
aa0f825 to
ffacf99
Compare

No description provided.