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
typing.Literal is supposed to accept enum members and not non-members (such as methods or explicit nonmember attributes). mypy fails to enforce the latter and support the former.
The following should be accepted in Literal: E.A, E.B, E.C
The following should be rejected in Literal: E.D, E.meth
Actual Behavior
(line 7 is a different issue reported separately)
main.py:7: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
main.py:14: error: Parameter 1 of Literal[...] is invalid [valid-type]
main.py:17: error: Parameter 1 of Literal[...] is invalid [valid-type]
Your Environment
Mypy version used: 1.15.0 and current master
Mypy command-line flags: N/A
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
typing.Literal
is supposed to accept enum members and not non-members (such as methods or explicitnonmember
attributes).mypy
fails to enforce the latter and support the former.To Reproduce
playground
Expected Behavior
E.A
,E.B
,E.C
E.D
,E.meth
Actual Behavior
(line 7 is a different issue reported separately)
Your Environment
mypy.ini
(and other config files): N/AThe text was updated successfully, but these errors were encountered: