Repository navigation
fix!: reject optional and arrow constructors - #74
Merged
Merged
Conversation
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Check the sentinel declaration's top-level owner, text and ranges in both public constructor tests through the shared constructor checker. Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #57
Why
Standalone
new foo?.bar()andnew () => 1currently produce successful trees although JavaScript rejects them. Restricting constructor syntax must preserve the canonical constructor supertype query and valid nestednewgrouping.Requirements
_constructor_atom/_type_arguments_target, and its old scanner has no appended JS marker. Existing TypeScript remains pinned to the old parent; its port is a separate repair.Customer Summary
Unparenthesized optional-chain and arrow constructors report syntax errors. Parenthesized optional/arrow constructors, tagged constructors and nested
newkeep canonical nodes and constructor captures.Technical Summary
Restricted constructor atoms and chains alias to the existing public node types and primary-expression supertype. The zero-width argumentless-new boundary prevents the parser from accepting an invalid continuation by ending
newearly; decimal conditional syntax remains available. The markers are appended after all 33 existing external tokens, never emitted during all-token recovery, and introduce no scanner state. Constructor functions use a scoped async-function start marker, with a same-line async/function keyword check; general declarations and await decisions remain intact. Source grammar and scanner must update together.The native lockfile and declared web runtime use 1.2.2. Public schema and ABI 15 remain unchanged. The newer generator/runtime preserves alias-supertype queries that fail with 1.0.16.
Testing
Current head 7b160e0 passes CI/readiness (launch 1791327657-b6cdc23661a849cc, no new events). Review 008daccf completed with five distinct fixes (three major, two minor) and one service-marked duplicate. Five of seven reviewers completed successful sessions; Claude Sonnet/Opus were unavailable. Last exploration covered a8b3712; completion 7b160e0 is not covered by a measured exploration session, while its test-only repair was independently rechecked. All 30 saved notes and five Requirements versions were inspected; generated tables were checked through regeneration, schema/token invariants and parser behavior. No full-table manual reading or universal recovery/performance claim is made.
Both public constructor tests use the shared checker to assert the trailing sentinel declaration's name, text, ranges and top-level ownership. A valid-source mutation moving the sentinel into the function passes the old checker and fails the new top-level ownership assertion. The focused constructor tests and lint/type verification pass; this test-only change leaves parser and Wasm artifacts unchanged.
The README names runtime 1.2.2 as the minimum for Rust/web consumers and uses grammar major 3 for this breaking release. The obsolete precedence-only constructor comment is removed. Regeneration retains identical parser, grammar JSON, node schema and Wasm bytes; existing runtime-version and query tests plus lint/types pass.
The four public async-constructor controls fail before repair and pass afterward. All 1095 baseline-clean nonoptional async controls retain complete trees/captures; seven focused raw grammarType trees remain exact. Of 1544 async records, 128 invalid optional-chain forms newly report errors, and one already-ERROR functionValue buffer changes recovery. The four public division controls fail on d3 and pass with the scanner guard; both constructor tests, lint and types pass. All 36 division controls preserve released main full trees and seven query sets (30 clean, six ERROR). All 2072 original constructor records remain exact before/after the repairs; rebuilt explicit native and Wasm classifications agree on all 2072. Current 199 corpus and 2552 await comparisons retain their documented outcomes.
mise exec rust@1.98.1 -- bun wb verify --fullwith constructor, runtime-version, query, incremental and corpus files: relevant existing checks pass; both new constructor tests subsequently pass with lint/types. Both new tests fail on released c32; restoring the candidate Wasm and timestamps is verified byte-for-byte.Notes
Breaking release: require runtime 1.2.2 and regenerate grammar/scanner together. TypeScript's current source extension needs a separate conflict/scanner port before it can adopt this parent; current released TypeScript is pinned to the old parent.
The grammar still lacks full Script/Module and innermost function/strict-mode validation (#55). Fifteen compiler-rejected yield contexts become parser-clean while 13 were already clean. Node and Acorn disagree on 32 import-related controls, so Node acceptance is scoped evidence. Legacy call-assignment behavior remains tracked separately in #58. Malformed
new () => 1may absorb a following declaration into ERROR; valid-source ownership and incremental restoration remain checked. Long-trivia costs increase as recorded above.