Skip to content

fix(semantic): report error on for-await inside block inside static block#20749

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/03-25-fix_parser_report_error_on_for-await_inside_block_inside_static_block
Mar 26, 2026
Merged

fix(semantic): report error on for-await inside block inside static block#20749
graphite-app[bot] merged 1 commit intomainfrom
c/03-25-fix_parser_report_error_on_for-await_inside_block_inside_static_block

Conversation

@camc314
Copy link
Copy Markdown
Contributor

@camc314 camc314 commented Mar 25, 2026

No description provided.

Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 25, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions github-actions bot added A-semantic Area - Semantic C-bug Category - Bug labels Mar 25, 2026
@camc314 camc314 marked this pull request as ready for review March 25, 2026 20:31
@camc314 camc314 requested a review from Dunqing as a code owner March 25, 2026 20:31
Copilot AI review requested due to automatic review settings March 25, 2026 20:31
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 25, 2026

Merging this PR will not alter performance

✅ 53 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing c/03-25-fix_parser_report_error_on_for-await_inside_block_inside_static_block (d34bf76) with main (14868fb)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 await inside 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.

@camc314 camc314 changed the title fix(parser): report error on for-await inside block inside static block fix(semantic): report error on for-await inside block inside static block Mar 26, 2026
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 26, 2026
Copy link
Copy Markdown
Contributor Author

camc314 commented Mar 26, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the c/03-25-fix_parser_report_error_on_for-await_inside_block_inside_static_block branch from d34bf76 to 560a969 Compare March 26, 2026 13:59
@graphite-app graphite-app bot force-pushed the c/03-25-fix_parser_report_error_on_for-await_inside_block_inside_static_block branch from 560a969 to ccf9301 Compare March 26, 2026 14:00
@graphite-app graphite-app bot merged commit ccf9301 into main Mar 26, 2026
26 checks passed
@graphite-app graphite-app bot deleted the c/03-25-fix_parser_report_error_on_for-await_inside_block_inside_static_block branch March 26, 2026 14:06
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-semantic Area - Semantic C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants