-
Notifications
You must be signed in to change notification settings - Fork 767
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
Missing support for unparenthesized expression list as match subject #1044
Comments
Note that even the syntax highlighting here on Github doesn't recognize the |
Thanks for pointing that out. I missed that part in PEP 634. I've modified the parser in pylance to support this. This will be fixed in the next release of pylance. The new pattern-matching feature introduces a significant addition to the Python grammar, so it's going to take a while for tools and libraries to add support. The library that github uses for syntax highlighting is one of many that will need to be updated. |
Sounds great, thanks! No, I wasn't really expecting any tools to support the new feature yet, but for a moment I thought github was recognizing the |
This issue has been fixed in version 2021.3.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202132-17-march-2021 |
It works! Thanks! |
Environment data
Expected behaviour
According to the syntax section of PEP 634 the new
match
statement takes a subject_expr which may be an unparenthesized list of comma-separated star_named_expressions, and this works fine in Python 3.10.0a6, so Pylance should not complain about it. I realize that Python 3.10.0 hasn't been released yet, but since Pylance seems to already handle mostmatch
syntax correctly, I thought I'd mention this deficit.Actual behaviour
Pylance covers the code in squiggly red lines if the subject_expr contains commas and is not parenthesized.
Logs
Code Snippet / Additional information
Without parentheses (bad)
With parentheses (OK)
The text was updated successfully, but these errors were encountered: