basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

Support distributed unions on generics

Open KotlinIsland opened this issue 3 years ago • 0 comments

Is this valid? Sounds valid to me

def f(i: list[T]) -> list[T]: ...

a: list[str] | list[int]

# current
reveal_type(f(a))  # Cannot infer type argument 1 of "f" # list[Any (from error)]

# expected
reveal_type(f(a))  # list[str] | list[int]

This sounds cool, but I think #360 covers the same usecase

KotlinIsland avatar Jul 28 '22 10:07 KotlinIsland