Avoid adding tuple in parsing of $(x) -> rhs
#534
Merged
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.
Quick fix for JuliaLang/julia#57223
This bug was brought on by the parsing change in #522. Basically, we can't reliably look ahead at the
K"->"token when parsing parentheses inparse_paren()if any construct with higher precedence is currently being parsed on the left hand side of the$. Luckily there's very few such constructs, but$is one of these.The others appear to be unary
&and unary::which are also entangled inwhereparsing so are a bit more difficult to fix. Thus the obscure and probably useless syntaxes::(x) -> yand&(x) -> yare currently broken.In principle, a way to fix this at the correct precedence level would be to rewrite the left hand side of
->when bumping theK"->"token itself, and when the left hand side was aK"parens"node. This almost works, but gets quite ugly for keyword parameters as in(x; a=1) -> bodywhere we need to rewrite the left hand side from a block to a tuple with contained parameters node.