fix(semantic): report error on await-using inside nested static block#20746
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
Updates the semantic checks so await using declarations inside nested scopes of a class static initialization block correctly produce an error, aligning behavior with TypeScript’s conformance expectations.
Changes:
- Expand the class-static-block detection for
await usingdeclarations by walking scope ancestors (stopping at function boundaries). - Add a reusable
is_in_class_static_blockhelper to support the new behavior. - Update the TypeScript parser coverage snapshot to include the new diagnostic output.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tasks/coverage/snapshots/parser_typescript.snap | Snapshot updated to include the new “Cannot use 'await using' in class static initialization block” diagnostic. |
| crates/oxc_semantic/src/checker/javascript.rs | Introduces ancestor-based class static block detection and uses it for await using variable declarations. |
Merge activity
|
…#20746) Fixes missing errors on the following case: ```ts class C { static { { await using y = null; } } } ```
6cccc2e to
2bad7f5
Compare

Fixes missing errors on the following case: