Closed
Description
from typing import TypeVar
T = TypeVar('T')
U = TypeVar('U')
def outer(x: T) -> T:
def inner(y: U) -> T: ...
return inner(1) # error: Incompatible return value type: expected T`-1, got builtins.int*
I should be able to pass inner
a value of any type and get back a T
to return from outer
. But internally the type variables U
and T
of inner
have the same id (-1) so effectively mypy thinks inner
has a type like (U) -> U
.