-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
(🐞) Error when using new union syntax and TypeVar
in generic TypeAlias
#12311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This isn't an error; it creates a generic alias. |
from typing import *
T = TypeVar("T")
A: TypeAlias = list[T] # no error
def foo(a: A) -> A: ...
reveal_type(foo([1])) # list[Any] Well something seems broken |
Also these forms are then inconsistent: A: TypeAlias = T | None # error
B: TypeAlias = T # error |
Your first example produces |
TypeVar
as type parameter in TypeAlias
TypeVar
in TypeAlias
TypeVar
in TypeAlias
TypeVar
in generic TypeAlias
@JelleZijlstra Fair enough, thanks for explaining. I've updated the title and OP, want to reopen it? |
That one's a PEP 604 bug; it works fine with And it's already been reported in a different issue, lemme just find it |
Here: #12211 |
Originally spotted by @Eldar1205
The text was updated successfully, but these errors were encountered: