You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromenumimportEnum, memberfromtypingimportassert_neverclassE1(Enum):
C=1defcheck_1(e: E1) ->None:
matche:
caseE1.C:
passcaseother:
assert_never(other) # OKifeisE1.C:
passelse:
assert_never(e) # OKclassE2(Enum):
@memberdefC() ->None: ... # E: Method must have at least one argument. Did you forget the "self" argument? [misc]defcheck_2(e: E2) ->None:
matche:
caseE2.C:
passcaseother:
assert_never(other) # E: Argument 1 to "assert_never" has incompatible type "E2"; expected "Never" [arg-type]ifeisE2.C:
passelse:
assert_never(e) # E: Argument 1 to "assert_never" has incompatible type "<subclass of "enum.member[Callable[[], None]]" and "__main__.E2">"; expected "Never" [arg-type]
main.py:22: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
main.py:29: error: Argument 1 to "assert_never" has incompatible type "E2"; expected "Never" [arg-type]
main.py:34: error: Argument 1 to "assert_never" has incompatible type "<subclass of "member" and "E2">"; expected "Never" [arg-type]
Found 3 errors in 1 file (checked 1 source file)
Your Environment
Mypy version used: 1.15.0 and current master
Mypy command-line flags: --strict and without
Mypy configuration options from mypy.ini (and other config files): N/A
Python version used: 3.12
The text was updated successfully, but these errors were encountered:
Bug Report
Functions decorated with
@enum.member
are as rightful enum members as simple non-callable attributes.Beware of #18721.
To Reproduce
playground
Expected Behavior
Green output.
Actual Behavior
Your Environment
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: