-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Untrue "missing return statement" after exhaustive match on enum #16276
Comments
Hello! @aleksanb Can I try to fix the issue? I am currently doing my assignment for software engineering and am supposed to try solve an issue like this one. You can assign the issue to me and I will try my best to help. |
Yes, don't ask, just open a PR. (mypy is doing the equivalent of |
…x the issue "Untrue "missing return statement" after exhaustive match on enum python#16276".
Duplicate of #12998 |
I don't think this is a duplicate of #12998 (fixed in 1.10?). I still have this issue with mypy 1.11+. Can we get this reopened? |
This was indeed fixed in 1.10. Try it yourself in the playground. If you have some other issue, please open a new issue :-) |
Ah, I see. The narrowing only works if you match against (e.g.) |
Bug Report
Exhaustive match on enums fails if no intermediate alias of the match variable is given.
To Reproduce
You can run this on https://mypy-play.net/?mypy=latest&python=3.11, and see that only
matcher_implicit
fails, but there's no reason why it should!Expected Behavior
Both should typecheck correctly
Actual Behavior
The first one fails typechecking, with a fake "missing return statement" error emitted.
Your Environment
The text was updated successfully, but these errors were encountered: