-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enum Literal Handling Regression #7926
Comments
I agree this is a bug, but I think the code sample is suspect and arguably should be considered a bug. Accessing enum members from an instance of an enum happens to work with Python's enum class, but it's probably not intended. Consider the following. Does this really make sense? print(MyEnum.ARG_1.ARG_2.ARG_1.ARG_2.ARG_1) Perhaps your code sample intends to return I'll update pyright to match the runtime behavior even though I think it doesn't make much sense in this case. |
…ng an enum member from an instance of an enum class. This addresses #7926.
You're right! My code did mean to do that, unfortunately we're accessing some configuration settings through Django typed as |
This is addressed in pyright 1.1.364. |
To preface, apologies if there's a simpler reproducible example here, mostly trying to replicate what's happening across modules in my codebase. In Pyright 1.1.362, something like this would have been fine:
That being, we alias an enum, and pass in value off the aliased type, now in 1.1.362, you'll get a warning when trying to pass in
ARG_1
:In this example, it's obviously pointless to alias, in reality, we have an enum setting that's we're aliasing to change the typing of, think,
MY_ENUM as MyEnum
, for a wrapper we have on some project settings.Pyright Playground
Version: 1.1.363
The text was updated successfully, but these errors were encountered: