You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just checked the outcome of the tests with: #17232:
3,4,5 would also be fixed
6 does not change (at least the if-branch; else branch looks correct)
Output:
../xx.py:12: note: Revealed type is "tuple[builtins.int]"
../xx.py:18: note: Revealed type is "tuple[builtins.str, builtins.int]"
../xx.py:22: note: Revealed type is "tuple[builtins.str]"
../xx.py:24: note: Revealed type is "tuple[Union[builtins.int, builtins.str]]"
../xx.py:28: note: Revealed type is "tuple[builtins.str, builtins.str]"
../xx.py:30: note: Revealed type is "tuple[Union[builtins.int, builtins.str], Union[builtins.int, builtins.str]]"
../xx.py:34: note: Revealed type is "builtins.tuple[builtins.str, ...]"
../xx.py:36: note: Revealed type is "builtins.tuple[Union[builtins.int, builtins.str], ...]"
../xx.py:40: note: Revealed type is "tuple[builtins.str, Never, builtins.str]"
../xx.py:42: note: Revealed type is "tuple[builtins.str, Unpack[builtins.tuple[Union[builtins.int, builtins.str], ...]], builtins.str]"
I noticed this behavior when investigating a similar issue in pyright.
Mypy isn't correctly narrowing tuples in some cases.
The text was updated successfully, but these errors were encountered: