diff --git a/crates/ty_python_semantic/resources/mdtest/generics/legacy/variables.md b/crates/ty_python_semantic/resources/mdtest/generics/legacy/variables.md index 8f86c35a55..13547e81be 100644 --- a/crates/ty_python_semantic/resources/mdtest/generics/legacy/variables.md +++ b/crates/ty_python_semantic/resources/mdtest/generics/legacy/variables.md @@ -107,15 +107,15 @@ reveal_type(S) # revealed: TypeVar ### No explicit specialization A type variable itself cannot be explicitly specialized; the result of the specialization is -`Unknown`. However, anything designated as a generic type alias by `typing.TypeAlias` can be -explicitly specialized. +`Unknown`. However, generic PEP 613 type aliases that point to type variables can be explicitly +specialized. ```py from typing import TypeVar, TypeAlias T = TypeVar("T") -BareAnnotated = T -Annotated: TypeAlias = T +ImplicitPositive = T +Positive: TypeAlias = T def _( # error: [invalid-type-form] "A type variable itself cannot be specialized" @@ -123,8 +123,8 @@ def _( # error: [invalid-type-form] "A type variable itself cannot be specialized" b: T[T], # error: [invalid-type-form] "A type variable itself cannot be specialized" - c: BareAnnotated[int], - d: Annotated[int], + c: ImplicitPositive[int], + d: Positive[int], ): reveal_type(a) # revealed: Unknown reveal_type(b) # revealed: Unknown diff --git a/crates/ty_python_semantic/resources/mdtest/generics/pep695/variables.md b/crates/ty_python_semantic/resources/mdtest/generics/pep695/variables.md index 289cf13ef4..8338227538 100644 --- a/crates/ty_python_semantic/resources/mdtest/generics/pep695/variables.md +++ b/crates/ty_python_semantic/resources/mdtest/generics/pep695/variables.md @@ -101,18 +101,17 @@ def f[T: (int,)](): ### No explicit specialization A type variable itself cannot be explicitly specialized; the result of the specialization is -`Unknown`. However, anything designated as a generic type alias by a type statement can be -explicitly specialized. +`Unknown`. However, generic type aliases that point to type variables can be explicitly specialized. ```py -type Annotated[T] = T +type Positive[T] = T def _[T]( # error: [invalid-type-form] "A type variable itself cannot be specialized" a: T[int], # error: [invalid-type-form] "A type variable itself cannot be specialized" b: T[T], - c: Annotated[int], + c: Positive[int], ): reveal_type(a) # revealed: Unknown reveal_type(b) # revealed: Unknown