Bug Report
The handling of types for IntEnum literals shows no overlap with int literals.
The handling for int variables appears to be correct,
To Reproduce
playground
fromenumimportIntEnumclassCardVal(IntEnum):
VAL_A=1VAL_2=2try:
assertCardVal.VAL_A==1exceptAssertionError:
pass# So we see the second error in mypyassertCardVal.VAL_2==2
Expected Behavior
The type of CardVal.VAL_A gets erased to something considered comparable to Literal[1]
Actual Behavior
From the playground link, using python 3.10 / mypy 1.6.1:
main.py:9: error: Non-overlapping equality check (left operand type: "Literal[CardVal.VAL_A]", right operand type: "Literal[1]") [comparison-overlap]
main.py:13: error: Non-overlapping equality check (left operand type: "Literal[CardVal.VAL_2]", right operand type: "Literal[2]") [comparison-overlap]
Found 2 errors in 1 file (checked 1 source file)
The same behaviour has been seen locally with python 3.11 / mypy 1.6.1
Bug Report
The handling of types for
IntEnumliterals shows no overlap withintliterals.The handling for int variables appears to be correct,
To Reproduce
playground
Expected Behavior
The type of
CardVal.VAL_Agets erased to something considered comparable toLiteral[1]Actual Behavior
From the playground link, using python 3.10 / mypy 1.6.1:
The same behaviour has been seen locally with python 3.11 / mypy 1.6.1