-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[1.16 regression] determining exhaustive match on an enum with type members #19151
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
Comments
Can I work on this issue ? |
Sure, please do. In general, don't need to ask, just put up PRs! Obviously most principled thing to do is understand what |
Thanks for the go-ahead, @hauntsaninja! I’ll start digging into the issue and put up a PR as soon as I have a fix. I’ll also take a closer look at how enums behave at runtime to make sure the solution is solid. Appreciate the guidance! |
@vidhyavijayan3, there's one gotcha to keep in mind when you implement this. In general, enum types can be expanded into their individual literal member types. For example, the type |
Thank you very much @erictraut for pointing that out. I understand the difference between enum and enum.Flag and the need to handle enum.Flag as a special case. I will review the relevant section of the typing specification to ensure I fully grasp the details before implementing the fix. I appreciate your helpful guidance! |
This comment has been minimized.
This comment has been minimized.
Type objects as enum values are supported at runtime. Fixes #19151.
Thanks for the fix @JukkaL ! I put that commit onto my local build of 1.16 and it worked great :) |
Type objects as enum values are supported at runtime. Fixes #19151.
Type objects as enum values are supported at runtime. Fixes python#19151.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I continued looking at how the codebase I work on responds to the upcoming mypy 1.16 release and I believe I found another bug
On mypy 1.16 I get this error
As far as I can tell this should be correct and I'm unsure why it doesn't think I have an exhaustive match.
Your Environment
mypy a.py
mypy.ini
(and other config files): no configThe text was updated successfully, but these errors were encountered: