-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-138857: Improve error message for case
outside of match
#138858
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with this but I wonder how often people may fall into this... I don't think is a bad idea I cannot see anything wrong with the grammar since the short circuit is NAME + NAME. Does this trigger for case match:
(afk atm so I cannot check myselef) ?
@pablogsal here's the result :) |
I always try to report parsing problems from errors that I make myself that make me scratch my head. Today I wrote this code while reviewing this PR: wemake-services/wemake-python-styleguide#3526 case some: # <- should be `match`
case other: ... and I was like: what's wrong? Why is there a syntax error? It was not easy to mention, especially given that some languages like |
Sold! Ok, let's get it in I think is a good idea. I was tempted to suggest getting:
as "maybe you mean match" but that's going to be a can of worms |
Preview:
What do you think? :)
case 1:
statement #138857