Skip to content

fix: improve cross-validation normalizer (103→105 matches)#235

Merged
VladimirMakaev merged 1 commit intofwcd:mainfrom
VladimirMakaev:fix/normalizer-improvements
Feb 20, 2026
Merged

fix: improve cross-validation normalizer (103→105 matches)#235
VladimirMakaev merged 1 commit intofwcd:mainfrom
VladimirMakaev:fix/normalizer-improvements

Conversation

@VladimirMakaev
Copy link
Copy Markdown
Collaborator

@VladimirMakaev VladimirMakaev commented Feb 20, 2026

Summary

Four normalizer improvements for the cross-validation tooling:

  • Labeled expressions: prefix_expression with a label child is now transparent, matching PSI's LABELED_EXPRESSION which is skipped. Fixes SimpleExpressions.
  • Comment-only bodies: control_structure_body containing only comments now produces an empty BLOCK instead of being dropped entirely. Fixes CommentsBindingInStatementBlock.
  • Destructuring declarations: DESTRUCTURING_DECLARATION_ENTRY added to SKIP_PSI_NODES, and DESTRUCTURING_DECLARATION children wrapped in VALUE_PARAMETER in lambda parameter lists. Reduces destructuringInLambdas diffs.
  • Property accessor cap: _nestPropertyAccessors now limits to 2 accessors per property, matching PSI error recovery.

Parser size

No change to parser.c — normalizer-only changes.

Impact

Match rate: 103/126 (81.7%) → 105/126 (83.3%)

Test plan

  • All 241 corpus tests pass
  • All 92 cross-validation unit tests pass
  • npm run cross-validate shows 105/126 match rate

@github-actions github-actions bot added the grammar Related to the grammar label Feb 20, 2026
@VladimirMakaev VladimirMakaev force-pushed the fix/normalizer-improvements branch from c664048 to 13abffb Compare February 20, 2026 03:11
Three normalizer improvements:

1. Labeled expressions: prefix_expression with label child is now
   transparent (matches PSI's LABELED_EXPRESSION which is skipped).
   Fixes SimpleExpressions.

2. Comment-only bodies: control_structure_body containing only
   comments now produces empty BLOCK instead of being dropped.
   Fixes CommentsBindingInStatementBlock.

3. Destructuring declarations: DESTRUCTURING_DECLARATION_ENTRY added
   to SKIP_PSI_NODES, and DESTRUCTURING_DECLARATION children wrapped
   in VALUE_PARAMETER in lambda parameter lists. Reduces
   destructuringInLambdas diffs from 20 to 19.

4. Property accessor cap: _nestPropertyAccessors now limits to 2
   accessors per property, matching PSI error recovery behavior.

Match rate: 103/126 (81.7%) → 105/126 (83.3%)
@VladimirMakaev VladimirMakaev force-pushed the fix/normalizer-improvements branch from 13abffb to 78b9536 Compare February 20, 2026 21:38
@VladimirMakaev VladimirMakaev marked this pull request as ready for review February 20, 2026 21:40
@VladimirMakaev VladimirMakaev merged commit 1e5884e into fwcd:main Feb 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grammar Related to the grammar

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant