Repository navigation
feat(syntax): remove lazy destructuring for tsrx RFC #106 parity - #86
Merged
Merged
Conversation
`&` directly before `{` or `[` in binding, assignment, loop-header,
arrow-parameter, catch-parameter, statement, @for, and @catch position is a
plain TypeScript syntax error again, as it is in tsrx since tsrx-org/tsrx#110.
There is no replacement syntax; bitwise `&` is unchanged.
Removes ParserLazyPattern, Overlay.parser_lazy_patterns, every scanner path
that registered them, both projection lanes' lazy actions and markers, the
formatter lift that re-printed the sigil, reconstruct/lazy_patterns.rs and
its wiring, and the helpers whose only callers were those paths. The lazy
tests become lazy_destructuring_is_not_supported plus a positive regression
for wrapped nested patterns and bitwise `&`. The site TextMate grammar drops
its six lazy-pattern highlighting rules.
Closes #85. Closes #40.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Merged
This branch was successfully deployed
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.
Removes lazy destructuring (
&{ … }/&[ … ]) to match tsrx RFC #106 (tsrx-org/tsrx#110).&directly before{or[in binding, assignment, loop-header, arrow-parameter, catch-parameter, statement,@for, and@catchposition is now a plain TypeScript syntax error, exactly as in TypeScript; bitwise&is unchanged.Closes #85. Closes #40: the remaining parity gap it describes (lazy patterns nested in assignment targets and TS wrappers) no longer exists on either side.
What changed
crates/tsrx_syntax:ParserLazyPatternandOverlay.parser_lazy_patternsare gone, along with every scanner path that registered them (parser_scanner/{lexical,header,control,region,state,overlay}.rs), both projection lanes' lazy actions andYmarkers, and the formatter lift that re-printed the&. Helpers whose only callers were the lazy paths (skip_balanced_pattern,arrow_follows_parameter_list,skip_type_expression,previous_significant_end, and friends) are deleted rather than allowed.crates/tsrx_parser_engine:reconstruct/lazy_patterns.rsis deleted with its wiring inprogram.rs,pipeline.rs,projection/gaps.rs, andprojection/marker_validation.rs.program_composition.rs,public_api.rs,tsrx_format, and onetsrx_lintfixture are replaced bylazy_destructuring_is_not_supported(the six tsrx negative cases pluscatch (&{ m })and three@for/@catchforms, all asserted as Grammar-phase failures) and a positive regression for wrapped nested patterns and bitwise&.docs/tsrx.tmLanguage.json: the six&highlighting rules the site grammar carried for lazy patterns are edited back to the upstream TypeScript-TmLanguage shape.Notes against the issue text
crates/tsrx_formatneeded only a test change. The&re-printer lived incrates/tsrx_syntax/src/projection/lift/parser.rs.crates/tsrx_syntax/src/parser_scanner/control.rs(the@for/@catchhooks) was missing from the issue's list and is included.docs/README.md,docs/archive/tsrx-parser-api.md,packages/vscode/README.md, orwebsite-oxcmention lazy destructuring; theirlazyhits are the lazy result transport or lazy-loaded assets. The only doc artefact touched is the TextMate grammar.[{ a } as T] = arris rejected by both OXC ("Cannot assign to this expression") and tsc 6 (TS2364), so it is asserted as a rejection. The wrapped-nested-pattern regressions that parse clean are[{ a }] = arr,[a as T] = arr, and[(a)] = arr.capabilities.lazy,experimentalLazy,utf16-lazy, thelazy_resultlanes inparser_napi_binding) is untouched.Observed behaviour
With the scanner no longer registering the sigil, the
&is copied verbatim into the projection and OXC reportsUnexpected tokenat it (Grammar phase);let &{ a } = b;reads as bitwiselet & {a}and fails withCannot assign to this expression..tsrxfiles with no other TSRX constructs take the direct OXC path and get OXC's unmodified diagnostic.Note
Medium Risk
Large removal across scan, project, reconstruct, and format paths changes how binding syntax parses and fails; misclassification of bitwise
&vs errors could affect existing.tsrxthat used lazy destructuring.Overview
Removes lazy destructuring (
&{…}/&[…]) across the stack so TSRX matches RFC #106: an&immediately before{or[in binding positions is treated as invalid TypeScript, not a special TSRX form. Bitwise&and normal destructuring are unchanged.The overlay no longer carries
ParserLazyPatternmetadata. Scanner registration, parser/type/format projection (includingYmarkers and format lift), gap/marker validation, and AST reconstruction inlazy_patterns.rsare deleted. Parser pipeline direct-parse eligibility no longer depends on lazy-pattern overlays.Tests and fixtures switch from asserting lazy round-trips to rejecting lazy spellings (including
@for/@catch) and accepting plain nested patterns and&in type/intersection/bitwise contexts. The TextMate grammar drops the extra&-before-pattern highlighting rules.Reviewed by Cursor Bugbot for commit 546bda7. Bugbot is set up for automated code reviews on this repo. Configure here.