`comparison-overlap` error not triggered for booleans
Open
Nobody has claimed this yet.
bug
topic-overlap
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
from typing import Literal
foo: Literal["foo"] = "foo"
# error: Non-overlapping equality check (left operand type: "Literal['foo']", right operand type: "Literal['bar']") [comparison-overlap]
foo == "bar"
bar: Literal[True]
# no error
bar == False
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the boolean example in the linked mypy playground and compare it with the reported Literal string comparison. Trace the comparison-overlap diagnostic handling for boolean operands; done means bar == False reports the expected non-overlapping equality error without regressing the existing string case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100