Skip to content

fix(parser): avoid duplicate exports during TLA reparse#22524

Closed
camc314 wants to merge 1 commit into
mainfrom
codex/fix-parser-await-export-duplicate
Closed

fix(parser): avoid duplicate exports during TLA reparse#22524
camc314 wants to merge 1 commit into
mainfrom
codex/fix-parser-await-export-duplicate

Conversation

@camc314

@camc314 camc314 commented May 18, 2026

Copy link
Copy Markdown
Contributor
  • Avoid recording module import/export side effects during the unambiguous top-level await reparse pass.
  • Add a misc parser coverage fixture for the .js auto-detect false duplicate export case.

fixes #22158
closes #22520

@github-actions github-actions Bot added the A-parser Area - Parser label May 18, 2026
@camc314 camc314 marked this pull request as ready for review May 18, 2026 09:41
Copilot AI review requested due to automatic review settings May 18, 2026 09:41
@codspeed-hq

codspeed-hq Bot commented May 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing codex/fix-parser-await-export-duplicate (35539b9) with main (f7967c7)

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a false Duplicated export diagnostic triggered in unambiguous (.js) parsing when a statement containing an ambiguous await token is reparsed with top-level-await context enabled, by preventing module-record side effects from being recorded during that reparse pass.

Changes:

  • Prevent module record import/export side effects from being duplicated during the unambiguous top-level-await reparse.
  • Add a misc coverage fixture reproducing the .js auto-detect duplicate-export case and update coverage snapshots accordingly.

Reviewed changes

Copilot reviewed 1 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/oxc_parser/src/lib.rs Temporarily swaps out module_record_builder during the top-level-await reparse loop to avoid duplicate module-record side effects.
tasks/coverage/misc/pass/oxc-22158.js Adds a regression fixture for the .js unambiguous + export var x = await + 1 case.
tasks/coverage/snapshots/parser_misc.snap Updates parser misc coverage counts after adding the new fixture.
tasks/coverage/snapshots/semantic_misc.snap Updates semantic misc coverage counts after adding the new fixture.
tasks/coverage/snapshots/transformer_misc.snap Updates transformer misc coverage counts after adding the new fixture.
tasks/coverage/snapshots/formatter_misc.snap Updates formatter misc coverage counts after adding the new fixture.
tasks/coverage/snapshots/codegen_misc.snap Updates codegen misc coverage counts after adding the new fixture.

Comment thread crates/oxc_parser/src/lib.rs
@Boshen

Boshen commented May 23, 2026

Copy link
Copy Markdown
Member

closed by #22684

@Boshen Boshen closed this May 23, 2026
@Boshen Boshen deleted the codex/fix-parser-await-export-duplicate branch May 23, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parser: false "Duplicated export" when await appears in variable initializer under .js auto-detect

3 participants