Skip to content

Conversation

@c42f
Copy link
Member

@c42f c42f commented Feb 5, 2025

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 in parse_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 in where parsing so are a bit more difficult to fix. Thus the obscure and probably useless syntaxes ::(x) -> y and &(x) -> y are 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 the K"->" token itself, and when the left hand side was a K"parens" node. This almost works, but gets quite ugly for keyword parameters as in (x; a=1) -> body where we need to rewrite the left hand side from a block to a tuple with contained parameters node.

@c42f c42f merged commit 4b17592 into main Feb 6, 2025
36 checks passed
@c42f c42f deleted the caf/fix-arrow-interp-lhs branch February 6, 2025 01:50
c42f added a commit to JuliaLang/julia that referenced this pull request Oct 17, 2025
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.

2 participants