Closed as not planned
Description
With disallow_any_generics
, this code:
from typing import TypeVar, Union
T1 = TypeVar('T1')
U1 = Union[T1, int]
x: U1 = 5
results in
main.py:6: error: Missing type parameters for generic type "U1" [type-arg]
The U1
type alias becomes generic and has a single argument. Curiously, it doesn't matter what you put there. For example, this passes:
x: U1[str] = 5
# ^^^
One might think it passes because T1
is unbound, but even if we bind it (e.g. to float
), it still passes:
T1 = TypeVar('T1', bound=float)
# ^^^^^
U1 = Union[T1, int]
x: U1[str] = 5
# ^^^