File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1446,6 +1446,14 @@ reveal_type(F[str]().m()) # N: Revealed type is "__main__.F[builtins.str]"
14461446reveal_type(F[str]().mm(b'x')) # N: Revealed type is "tuple[__main__.F[builtins.str], builtins.bytes]"
14471447[builtins fixtures/tuple.pyi]
14481448
1449+ [case testTypingSelfInvalidLocationsTypeParams]
1450+ # flags: --python-version 3.12
1451+ from typing import Self
1452+
1453+ class C:
1454+ def bounded[T: Self](self: T) -> None: ... # E: Self type cannot be used in a type parameter bound
1455+ def constrained[T: (C, Self)](self: T) -> None: ... # E: Self type cannot be used in a type parameter constraint
1456+
14491457[case testPEP695CallAlias]
14501458class C:
14511459 def __init__(self, x: str) -> None: ...
Original file line number Diff line number Diff line change @@ -1494,14 +1494,6 @@ def func() -> None:
14941494
14951495class C(Self): ... # E: Self type is only allowed in annotations within class definition
14961496
1497- [case testTypingSelfInvalidLocationsTypeParams]
1498- # flags: --python-version 3.12
1499- from typing import Self
1500-
1501- class C:
1502- def bounded[T: Self](self: T) -> None: ... # E: Self type cannot be used in a type parameter bound
1503- def constrained[T: (C, Self)](self: T) -> None: ... # E: Self type cannot be used in a type parameter constraint
1504-
15051497[case testTypingSelfInvalidArgs]
15061498from typing import Self, List
15071499
You can’t perform that action at this time.
0 commit comments