Skip to content

Commit 872aeb1

Browse files
go back to using tuple, but add more override statements where it complained last time
1 parent 471973b commit 872aeb1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

test-data/unit/check-flags.test

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,8 +2487,7 @@ class Child(Parent):
24872487
@override
24882488
def g(self, y: int) -> bool: #type: ignore # E: Unused "type: ignore" comment # E: "type: ignore" comment without error code
24892489
return True
2490-
[builtins fixtures/primitives.pyi]
2491-
[typing fixtures/typing-full.pyi]
2490+
[builtins fixtures/tuple.pyi]
24922491

24932492
[case testSpotCheckErrorCodeAllNotUsed]
24942493
# This test case exists purely to ensure that the testSpotCheckErrorCodeAll test does not become obsolete.
@@ -2511,5 +2510,4 @@ class Child(Parent):
25112510
@override
25122511
def g(self, y: int) -> bool: #type: ignore
25132512
return True
2514-
[builtins fixtures/primitives.pyi]
2515-
[typing fixtures/typing-full.pyi]
2513+
[builtins fixtures/tuple.pyi]

test-data/unit/fixtures/tuple.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import _typeshed
44
from typing import Iterable, Iterator, TypeVar, Generic, Sequence, Optional, overload, Tuple, Type, Self
5+
from typing_extensions import override
56

67
_T = TypeVar("_T")
78
_Tco = TypeVar('_Tco', covariant=True)
@@ -15,8 +16,10 @@ class type:
1516
def __call__(self, *a: object) -> object: pass
1617
class tuple(Sequence[_Tco], Generic[_Tco]):
1718
def __new__(cls: Type[_T], iterable: Iterable[_Tco] = ...) -> _T: ...
19+
@override
1820
def __iter__(self) -> Iterator[_Tco]: pass
1921
def __contains__(self, item: object) -> bool: pass
22+
@override
2023
@overload
2124
def __getitem__(self, x: int) -> _Tco: pass
2225
@overload
@@ -42,11 +45,13 @@ class bytes: pass
4245
class bytearray: pass
4346

4447
class list(Sequence[_T], Generic[_T]):
48+
@override
4549
@overload
4650
def __getitem__(self, i: int) -> _T: ...
4751
@overload
4852
def __getitem__(self, s: slice) -> list[_T]: ...
4953
def __contains__(self, item: object) -> bool: ...
54+
@override
5055
def __iter__(self) -> Iterator[_T]: ...
5156

5257
def isinstance(x: object, t: type) -> bool: pass

0 commit comments

Comments
 (0)