You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test-data/unit/check-python312.test
+14-14
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
[case test695TypeAlias]
2
-
type MyInt = int # E: PEP 695 type aliases are not yet supported
2
+
type MyInt = int # E: PEP 695 type aliases are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support
3
3
4
4
def f(x: MyInt) -> MyInt:
5
5
return reveal_type(x) # N: Revealed type is "builtins.int"
6
6
7
-
type MyList[T] = list[T] # E: PEP 695 type aliases are not yet supported \
7
+
type MyList[T] = list[T] # E: PEP 695 type aliases are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
8
8
# E: Name "T" is not defined
9
9
10
10
def g(x: MyList[int]) -> MyList[int]: # E: Variable "__main__.MyList" is not valid as a type \
@@ -17,21 +17,21 @@ def h(x: MyInt2) -> MyInt2:
17
17
return reveal_type(x) # N: Revealed type is "builtins.int"
18
18
19
19
[case test695Class]
20
-
class MyGen[T]: # E: PEP 695 generics are not yet supported
20
+
class MyGen[T]: # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support
21
21
def __init__(self, x: T) -> None: # E: Name "T" is not defined
22
22
self.x = x
23
23
24
24
def f(x: MyGen[int]): # E: "MyGen" expects no type arguments, but 1 given
25
25
reveal_type(x.x) # N: Revealed type is "Any"
26
26
27
27
[case test695Function]
28
-
def f[T](x: T) -> T: # E: PEP 695 generics are not yet supported \
28
+
def f[T](x: T) -> T: # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
29
29
# E: Name "T" is not defined
30
30
return reveal_type(x) # N: Revealed type is "Any"
31
31
32
32
reveal_type(f(1)) # N: Revealed type is "Any"
33
33
34
-
async def g[T](x: T) -> T: # E: PEP 695 generics are not yet supported \
34
+
async def g[T](x: T) -> T: # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
35
35
# E: Name "T" is not defined
36
36
return reveal_type(x) # N: Revealed type is "Any"
37
37
@@ -41,26 +41,26 @@ reveal_type(g(1)) # E: Value of type "Coroutine[Any, Any, Any]" must be used \
41
41
42
42
[case test695TypeVar]
43
43
from typing import Callable
44
-
type Alias1[T: int] = list[T] # E: PEP 695 type aliases are not yet supported \
44
+
type Alias1[T: int] = list[T] # E: PEP 695 type aliases are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
45
45
# E: Name "T" is not defined
46
-
type Alias2[**P] = Callable[P, int] # E: PEP 695 type aliases are not yet supported \
46
+
type Alias2[**P] = Callable[P, int] # E: PEP 695 type aliases are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
47
47
# E: Value of type "int" is not indexable \
48
48
# E: Name "P" is not defined
49
-
type Alias3[*Ts] = tuple[*Ts] # E: PEP 695 type aliases are not yet supported \
49
+
type Alias3[*Ts] = tuple[*Ts] # E: PEP 695 type aliases are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
50
50
# E: Name "Ts" is not defined
51
51
52
-
class Cls1[T: int]: ... # E: PEP 695 generics are not yet supported
53
-
class Cls2[**P]: ... # E: PEP 695 generics are not yet supported
54
-
class Cls3[*Ts]: ... # E: PEP 695 generics are not yet supported
52
+
class Cls1[T: int]: ... # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support
53
+
class Cls2[**P]: ... # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support
54
+
class Cls3[*Ts]: ... # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support
55
55
56
-
def func1[T: int](x: T) -> T: ... # E: PEP 695 generics are not yet supported \
56
+
def func1[T: int](x: T) -> T: ... # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
57
57
# E: Name "T" is not defined
58
58
59
-
def func2[**P](x: Callable[P, int]) -> Callable[P, str]: ... # E: PEP 695 generics are not yet supported \
59
+
def func2[**P](x: Callable[P, int]) -> Callable[P, str]: ... # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
60
60
# E: The first argument to Callable must be a list of types, parameter specification, or "..." \
61
61
# N: See https://mypy.readthedocs.io/en/stable/kinds_of_types.html#callable-types-and-lambdas \
62
62
# E: Name "P" is not defined
63
-
def func3[*Ts](x: tuple[*Ts]) -> tuple[int, *Ts]: ... # E: PEP 695 generics are not yet supported \
63
+
def func3[*Ts](x: tuple[*Ts]) -> tuple[int, *Ts]: ... # E: PEP 695 generics are not yet supported. Use --enable-incomplete-feature=NewGenericSyntax for experimental support \
0 commit comments