Commit 5451ff0
committed
GROOVY-10355: restore binary reading of (name) +/- x and (name) in/as x (design sketch)
A parenthesized bare name whose final segment starts lowercase is by
convention a value, not a class, so a cast mis-parse of the ambiguous
shapes is rebuilt in AstBuilder as the binary expression the syntax
visually suggests, preserving textual left-to-right grouping across
precedence levels. The binary-only keywords in/as captured as cast
operand identifiers are restored to their relational reading for any
capitalization. Unresolvable bare-name cast types now carry a hint
explaining the ambiguity and the ((name)) workaround.
The grammar is unchanged: a predicate-gated castExprAlt is not viable
because adaptive prediction under the me.sunlan antlr4 fork only
consults semantic predicates when a decision conflict is registered,
which this decision never produces, so the predicate would only fire
as a parse-time FailedPredicateException.1 parent 63be01f commit 5451ff0
4 files changed
Lines changed: 706 additions & 10 deletions
File tree
- src
- main/java/org
- apache/groovy/parser/antlr4
- codehaus/groovy/control
- test/groovy/bugs
0 commit comments