Repository navigation
fix: accept parenthesized Java assignment targets - #36
Merged
Merged
Conversation
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>
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.
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-orchardcommit0d25d5a8.Requirements
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_expressionnode inassignment_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
bun run verifypasses with zero code-gauge findings; 67 focused tests across 11 files pass.cargo test --lockedpasses the native load test and executable documentation.parenthesized_expressionin 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.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.