Bug Report, To Reproduce, and Actual Behaviour
If the enum member's name to compare isn't equal to the comparing value, a false positive comparison-overlap is triggered. See mypy Playground:
from enum import Enum
class A(str, Enum): # Same behaviour if `class A(enum.StrEnum)`
a = "b"
A.a == "a" # OK
A.a == "b" # E: Non-overlapping equality check (left operand type: "Literal[A.a]", right operand type: "Literal['b']") [comparison-overlap]
Expected Behavior
No errors
Your Environment
- Mypy version used: 1.17, master
- Python version used: 3.12