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

(🐞) Heterogeneous Enum's .value is Any & Union of homogeneous Enums .value is Any #15938

Open
KotlinIsland opened this issue Aug 23, 2023 · 0 comments · May be fixed by #15939
Open

(🐞) Heterogeneous Enum's .value is Any & Union of homogeneous Enums .value is Any #15938

KotlinIsland opened this issue Aug 23, 2023 · 0 comments · May be fixed by #15939
Labels
bug mypy got something wrong topic-enum

Comments

@KotlinIsland
Copy link
Contributor

from enum import Enum


class Homo1(Enum):
    A = 1
    B = 2
class Homo2(Enum):
    A = 1
    B = 2
class Hetero(Enum):
    A = 1
    B = ""

homo: Homo1
reveal_type(homo.value)  # 1 | 2
hetero: Hetero
reveal_type(hetero.value)  # Any
homo_union: Homo1 | Homo2
reveal_type(homo_union.value)  # Any
@KotlinIsland KotlinIsland added the bug mypy got something wrong label Aug 23, 2023
@KotlinIsland KotlinIsland changed the title (🐞) Homogeneous Enum's .value is Any & Union of heterogeneous Enums .value is Any (🐞) Heterogeneous Enum's .value is Any & Union of homogeneous Enums .value is Any Aug 23, 2023
@sobolevn sobolevn linked a pull request Aug 23, 2023 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants