Open AlexBlandin opened 5 months ago
it's not just match statements. the issue is that equality checks on tuples don't narrow their type:
from typing import assert_never
def bar(a: tuple[bool]) -> None:
if a == (True,):
...
elif a == (False,):
...
else:
assert_never(a) # error: Type "tuple[bool]" is incompatible with type "Never"
looks like this has been raised upstream but was rejected: https://github.com/microsoft/pyright/issues/6437
looks like it was fixed upstream for match statements but not if statements
Version: BasedPyright v1.12.0
As seen below, the snippet
foo
has this error ona, b
, whilebar
passes.