-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parsing issues with unary operators followed by (
#26137
Comments
We also forgot to treat operators as functions with the "no space between functions and
I expect the same behavior as
|
Yeah... what's happening is there's an ambiguity between parsing |
There's a comma in these examples, though - I don't feel these count as "parenthesized expressions" but rather tuple and named tuple literals. One thing which I find confusing is that In the former scheme maybe there should also be a difference between
Also, the last one is a valid way of defining a method on (the function) Parsing issues get confusing, fast... |
See #12771. The tricky case is Applying a unary operator to a tuple is not useful, so I don't see it helping to parse We can patch up I'll try to come up with something. I think we should prefer to treat |
(
RFC: fix #26137, change parsing of unary ops on parenthesized expressions
I made a typo (
-+
instead of.+
) and I found the result very surprising:I don't know where to start... it's just so... so...
(Happens on v0.7 and v0.6. EDIT: to be clear, I really expected the parser to greedily create a
NamedTuple
before worrying about the operators).The text was updated successfully, but these errors were encountered: