Closed
Description
from typing import Callable, TypeVar
R = TypeVar('R')
Carry = TypeVar('Carry')
X = TypeVar('X')
Y = TypeVar('Y')
def api_boundary(f: Callable[..., R]) -> Callable[..., R]:
return f
@api_boundary # Removing this decorator fixes things.
def scan(f: Callable[[Carry, X], tuple[Carry, Y]],
init: Carry,
xs: X) -> tuple[Carry, Y]:
...
def f(c: int, x: bool) -> tuple[int, float]:
return (c, 1.0)
reveal_type(scan(f, 1, True)) # Tuple[Carry`-1, Y`-3]
This is on Mypy 0.921.
Or maybe I've misunderstood type inference, and just have to wait for PEP 612 to finish being implemented?