Closed
Description
Code in question:
Lines 3232 to 3243 in 93d1ce4
This is a problem, because methods decorated as @member
are not included into the members list.
The simplest repro where this is a problem:
from enum import Enum, member
from typing import reveal_type
class Pet(Enum):
CAT = 1
@member
def human(self) -> int:
return 2
def a(x: Pet) -> None:
if x is not Pet.CAT:
reveal_type(x)
With --warn-unreachable
it will produce:
ex.py:13: note: Revealed type is "enum.member[def (self: ex.Pet) -> builtins.int]"
ex.py:18: error: Statement is unreachable [unreachable]
Because .enum_members
here will only contain CAT
:
Lines 974 to 978 in 93d1ce4
I will send a PR with the fix.