Skip to content

fix: accept parenthesized Java assignment targets - #36

Merged
exKAZUu merged 1 commit into
mainfrom
fix/parenthesized-assignment-targets
Oct 21, 2026
Merged

exKAZUu merged 1 commit into
mainfrom
fix/parenthesized-assignment-targets

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Why

The published grammar 8.0.1 rejects valid assignments such as (local) = 1, ((this.field)) += 4, and (values[0]) = 5. The complete fixture and all 72 combinations of 12 assignment operators with six parenthesized target forms compile cleanly with JDK 27. JLS 27 §15.26.1 explicitly covers parentheses around assignment operands.

This addresses grammar-orchard/tree-sitter-java-orchard commit 0d25d5a8.

Requirements

  • required: Improve our forked grammar repositories, excluding CSS and Markdown, as much as possible, ignoring backward compatibility.
  • required: Review existing fork issues and major upstream issues, PRs, and recent commits; prevent duplicate PRs and open a dedicated PR from the latest main for each item that warrants resolution.
  • required: Run review-booster and complete-pr concurrently, then release to publish the changes.
  • required: Parse assignments and compound assignments to parenthesized Java variables, fields and array elements, including nested parentheses and chained assignments; retain their left, operator and right fields.
  • required: Preserve ordinary expression/declaration syntax, assignment associativity, shipped queries, source ranges and consistent incremental editing.
  • chosen: Reuse the existing parenthesized_expression node in the assignment left field, matching the maintained upstream fix and preserving the normal parenthesis tree. Semantic assignability remains a compiler check, consistent with the existing expression rules; a separate target-only grammar would duplicate expression structure without enforcing type-dependent validity.

Customer Summary

Assignments to parenthesized variables, fields, and array elements retain their expression trees, operators, and source ranges, including nested parentheses and chained or mixed compound assignments.

Technical Summary

Allow the existing parenthesized_expression node in assignment_expression.left. The schema only extends that field's allowed node types. The corpus covers each target form, nested parentheses, and right-associative assignment chains.

Testing

  • Checksummed official JDK 27.0.1.0.2 compiles the full fixture and 72-case operator/target grid together with empty diagnostics; actual public Java 8.0.1 rejects both.
  • Canonical generation passes all 161 native and Wasm corpus cases without warnings. All 161 pass 100 incremental-fuzz iterations with 10 edits and seed 1.
  • bun run verify passes with zero code-gauge findings; 67 focused tests across 11 files pass.
  • cargo test --locked passes the native load test and executable documentation.
  • Wasm API checks assert ten exact chained/mixed assignment structures, all 72 left/operator/right combinations, and 81 scoped target captures. Six parenthesis edit/undo states match fresh full metadata, fields, anonymous tokens and custom/shipped query captures.
  • The schema differs from published 8.0.1 only by permitting parenthesized_expression in the assignment left field. Thirty unchanged full trees/query controls, all 240 whitespace-sensitive trees, and six further CST/query controls match published 8.0.1 exactly.
  • Full cross-platform, browser, Worker, example, and robustness checks run in PR CI.

Notes

As with other expression rules, the compiler checks whether an operand denotes an assignable variable. Generated C is retained exactly as emitted by the runtime 9 CLI, including trailing whitespace; the authored-file whitespace check passes.

Retain parenthesized variable, field and array targets in assignment left
fields, including nested parentheses and right-associative assignments.

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu exKAZUu self-assigned this Oct 21, 2026
@exKAZUu
exKAZUu merged commit e0e1edc into main Oct 21, 2026
10 checks passed
@exKAZUu
exKAZUu deleted the fix/parenthesized-assignment-targets branch October 21, 2026 23:24
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