Closed
Description
from typing import TypeVar, Callable
S = TypeVar('S')
def apply(f: Callable[[int], S]) -> S: pass
def g(x: int) -> S: pass
y = apply(g)
reveal_type(y) # E: Revealed type is 'S`-1'
The type of y
is not allowed to contain an unbound type variable. There should have been an error Need type annotation for variable
on the assignment to y
.
(With apply
having type def apply(f: Callable[[int], int]) -> S
, mypy does give such an error.)