Skip to content

test: preserve import attribute statement boundaries - #72

Merged
exKAZUu merged 5 commits into
mainfrom
fix/import-attribute-with-boundary
Oct 7, 2026
Merged

exKAZUu merged 5 commits into
mainfrom
fix/import-attribute-with-boundary

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Why

Import/re-export attributes and a following with statement share a keyword. A newline before with ( must not silently terminate the declaration: ECMAScript ASI inserts before an offending token, and with is already a permitted WithClause continuation. V8 rejects this unseparated form.

Requirements

  • required: Improve all resolvable issues across the requested grammar repositories, check existing PRs to prevent duplicates, and create a separate PR for each repair worth addressing.
  • required: For each PR, run review-booster, then complete-pr, then release.
  • required: Preserve import/re-export attributes, public nodes and incremental parsing.
  • chosen: Retain the existing scanner behavior and add regression coverage for import/re-export attribute boundaries. ECMAScript ASI rule 1 and WithClause commit to with before the offending parenthesis; V8 rejects both import and re-export newline-with-parenthesis forms. The previous object-lookahead relaxation incorrectly made them clean. TypeScript's permissive re-export recovery does not justify that relaxation.
  • chosen: Verify attributes across existing trivia forms, erroneous unseparated with statements, explicit-semicolon controls and edits between attributes and separated statements. Strict-mode early errors and module-only HTML-comment restrictions remain outside this grammar's existing syntax-tree contract.

Customer Summary

Regression coverage preserves import attributes and detects invalid statement boundaries while checking explicitly separated statements and incremental edits.

Technical Summary

A public Wasm test covers five import/re-export forms and seven existing trivia forms, including HTML comments. It checks erroneous unseparated with ( forms, attribute objects, explicit-semicolon controls, following declarations and edits in both directions. Production scanner, grammar and node schema match main.

Testing

bun wb verify --full test/unit/importAttributeBoundary.test.ts test/unit/corpus.test.ts test/unit/incremental.test.ts passes. V8 rejects both import and re-export newline-with-parenthesis forms; TypeScript rejects import forms syntactically but treats re-export forms as strict-mode-invalid statements. The ECMAScript ASI and WithClause productions support keeping the existing scanner behavior. Full platform and sanitizer checks run in CI.

Notes

Review established that the proposed scanner relaxation accepted invalid boundaries, so this PR retains the original implementation and adds regression coverage. Strict-mode early errors and module-only HTML-comment restrictions remain outside the existing grammar contract.

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu exKAZUu self-assigned this Oct 6, 2026
exKAZUu and others added 4 commits October 7, 2026 00:40
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Keep the scanner's ASI behavior and cover attributes, invalid unseparated
with statements, explicit separators and incremental edits.

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu exKAZUu changed the title fix: separate following with statements from import attributes test: preserve import attribute statement boundaries Oct 7, 2026
@exKAZUu
exKAZUu merged commit c9d7944 into main Oct 7, 2026
11 checks passed
@exKAZUu
exKAZUu deleted the fix/import-attribute-with-boundary branch October 7, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant