Skip to content

Parentheses parsed as tuple in ::(x) -> y and &(x) -> y #535

@c42f

Description

@c42f

As reported in JuliaLang/julia#57223 and partly fixed in #534 the parsing change in #522 had the unintended consequences of parsing parentheses as a tuple in these cases.

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 - it appears only the unary prefixes $, & and ::. I've fixed unary $ in #534 but unary & and unary :: are entangled in where parsing so are a bit more difficult to fix. Thus the obscure and probably-useless syntaxes ::(T) -> y and &(x) -> y are currently broken.

It's hard to imagine what ::(T) -> y could be useful for, but it is valid syntax so we should still fix this. &(T) -> y is even less useful because unary & has been invalid in lowering for a very long time (Julia 0.4 or 0.3 ish ??), but perhaps a macro somewhere could rely on it.

The most obvious way to fix this is to ensure has_unary_prefix from #534 is also applied to parsing of :: and & which might require carefully adding it to the arguments of a few more functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy