Type narrowing discards tuple from Union[Tuple, Sequence]
in conditional
#13749
Labels
Union[Tuple, Sequence]
in conditional
#13749
Bug Report
When refining an element of type
Union[Tuple, Sequence]
with theisinstance(x, Sequence)
in a conditional, theTuple
part of the type is wrongly discarded in the branch.To Reproduce
Expected Behavior
The revealed type of
x
should beUnion[Tuple[int], Sequence[str]]
or something equivalent. The linereturn x[0]
should be marked as an issue, because currentlytest_func((1,))
returns1
so the functions shouldn't typecheck.Actual Behavior
Your Environment
Used a fresh virtual environment
The text was updated successfully, but these errors were encountered: