Open
Description
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 😿.