Closed as not planned
Closed as not planned
Description
Bug report
Bug description:
After using Concatenate to recursively replace a ParamSpec of a TypeAliasType
, another subscription with a type param is possible but the type param is not recognized.
In the last part the following code (C2T = C2[T] # <--- should create a generic
), however it's parameters are empty and it cannot be subscripted further:
Consider the following code sample, also availiable on pyright playground
from typing import TypeAliasType, Concatenate, ParamSpec, Any, TypeVar
from collections.abc import Callable
# (**P) -> str
type C[**P] = Callable[P, str]
T = TypeVar("T")
P2 = ParamSpec("P2")
# (int, **P2) -> str
C2 = C[Concatenate[int, P2]]
# OK
# (T) -> str
C1T = C[T]
# (str) -> str
C1_str = C1T[str]
# --------
# (int, T) -> str
C2T = C2[T] # <--- does not create a generic
print(C2T.__parameters__) # <-- is empty
# ()
# (int, str) -> str
C2_str = C2T[str] # <-- cannot be subscripted
# TypeError: C[(<class 'int'>, ~T)] is not a generic class
CPython versions tested on:
3.13
Operating systems tested on:
Linux