Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Literal[⟨enum⟩] not callable even if enum is callable #17222

Open
user202729 opened this issue May 7, 2024 · 0 comments
Open

Literal[⟨enum⟩] not callable even if enum is callable #17222

user202729 opened this issue May 7, 2024 · 0 comments
Labels
bug mypy got something wrong topic-enum

Comments

@user202729
Copy link

To Reproduce

https://mypy-play.net/?mypy=latest&python=3.12&gist=7a3708ec5466904d85b33bc6196c0db9

Code copied here:

import enum
import typing

class A(enum.Enum):
    a = 1
    b = 2
    def __call__(self)->int: return 2

x=A.a
print(x())  # okay
if x==A.a:
    print(x())  # error???

Expected Behavior

No error happen

Actual Behavior

error: "Literal[A.a]" not callable  [misc]
@user202729 user202729 added the bug mypy got something wrong label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-enum
Projects
None yet
Development

No branches or pull requests

2 participants