Bug Report
If I define a method with @functools.cache on an Enum, then the type of that Enum's value attr becomes Any. Without the @functools.cache annotation, it gets typed correctly.
Also, this behavior does not occur if you use enum literals - i.e., Foo.BAR.value is typed correctly, but foo.value (for a foo: Foo) is wrong.
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.12&gist=b2a218b8db8367b2ac62dcf583a8c4f7
Expected Behavior
The type assertion in frobnicate() should succeed.
Actual Behavior
The type assertion in frobnicate() fails 😿.
Bug Report
If I define a method with
@functools.cacheon anEnum, then the type of thatEnum'svalueattr becomesAny. Without the@functools.cacheannotation, it gets typed correctly.Also, this behavior does not occur if you use enum literals - i.e.,
Foo.BAR.valueis typed correctly, butfoo.value(for afoo: Foo) is wrong.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.12&gist=b2a218b8db8367b2ac62dcf583a8c4f7
Expected Behavior
The type assertion in
frobnicate()should succeed.Actual Behavior
The type assertion in
frobnicate()fails 😿.