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
Fix crash in match statement if class name is undefined #12417
Conversation
test-data/unit/check-python310.test
Outdated
|
||
match m: | ||
case xyz(y=z): # E: Name "xyz" is not defined | ||
reveal_type(y) # E: Cannot determine type of "y" \ |
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.
reveal_type(y) # E: Cannot determine type of "y" \ | |
reveal_type(z) # E: Cannot determine type of "z" \ |
I think it picks it up y
from the previous match
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.
Oops, updated.
match m: | ||
case xyz(y): # E: Name "xyz" is not defined | ||
reveal_type(m) # N: Revealed type is "Any" | ||
reveal_type(y) # E: Cannot determine type of "y" \ |
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.
"Cannot determine type" is a bit unfortunate; I'd rather it's just Any. Probably fine this way though.
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.
Yeah, Any would be better, but I think that this would require a much bigger change.
This comment has been minimized.
This comment has been minimized.
1 similar comment
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Fixes #12416.