In the file foo.py:
from typing import Tuple, TypeVar
T = TypeVar('T')
TT = Tuple[T, T]
def car(items: TT) -> T:
reveal_type(items)
return items[0]
The revealed type is Tuple[Any, Any]:
➜ ~ git:(master) ✗ mypy --version
mypy 0.701
➜ ~ git:(master) ✗ mypy foo.py
foo.py:8: error: Revealed type is 'Tuple[Any, Any]'
I believe the correct type should have been the same as in this file bar.py:
from typing import Tuple, TypeVar
T = TypeVar('T')
def car(items: Tuple[T, T]) -> T:
reveal_type(items)
return items[0]
Which produces the output:
➜ ~ git:(master) ✗ mypy --version
mypy 0.701
➜ ~ git:(master) ✗ mypy bar.py
bar.py:7: error: Revealed type is 'Tuple[T`-1, T`-1]'
In the file
foo.py:The revealed type is
Tuple[Any, Any]:I believe the correct type should have been the same as in this file
bar.py:Which produces the output: