mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-01 17:13:24 +08:00
List[Foo] + List[Bar] now returns List[Foo | Bar] (#8293)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -986,8 +986,12 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
@overload
|
||||
def __setitem__(self, __s: slice, __o: Iterable[_T]) -> None: ...
|
||||
def __delitem__(self, __i: SupportsIndex | slice) -> None: ...
|
||||
# Overloading looks unnecessary, but is needed to work around complex mypy problems
|
||||
@overload
|
||||
def __add__(self, __x: list[_T]) -> list[_T]: ...
|
||||
def __iadd__(self: Self, __x: Iterable[_T]) -> Self: ...
|
||||
@overload
|
||||
def __add__(self, __x: list[_S]) -> list[_S | _T]: ...
|
||||
def __iadd__(self: Self, __x: Iterable[_T]) -> Self: ... # type: ignore[misc]
|
||||
def __mul__(self, __n: SupportsIndex) -> list[_T]: ...
|
||||
def __rmul__(self, __n: SupportsIndex) -> list[_T]: ...
|
||||
def __imul__(self: Self, __n: SupportsIndex) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user