@@ -90,6 +90,7 @@ _T2 = TypeVar("_T2")
90
90
_T3 = TypeVar ("_T3" )
91
91
_T4 = TypeVar ("_T4" )
92
92
_T5 = TypeVar ("_T5" )
93
+ _Expected = TypeVar ("_Expected" )
93
94
_SupportsNextT_co = TypeVar ("_SupportsNextT_co" , bound = SupportsNext [Any ], covariant = True )
94
95
_SupportsAnextT_co = TypeVar ("_SupportsAnextT_co" , bound = SupportsAnext [Any ], covariant = True )
95
96
_AwaitableT = TypeVar ("_AwaitableT" , bound = Awaitable [Any ])
@@ -1138,9 +1139,9 @@ class list(MutableSequence[_T]):
1138
1139
# Overloading looks unnecessary, but is needed to work around complex mypy problems
1139
1140
@overload
1140
1141
# # `__add__` returns a new object, so we capture the expected result type with a type variable
1141
- def __add__ (self , value : list [_T ], / ) -> list [_T1 | _T ]: ...
1142
+ def __add__ (self , value : list [_T ], / ) -> list [_Expected | _T ]: ...
1142
1143
@overload
1143
- def __add__ (self , value : list [_S ], / ) -> list [_T1 | _T | _S ]: ...
1144
+ def __add__ (self , value : list [_S ], / ) -> list [_Expected | _T | _S ]: ...
1144
1145
def __iadd__ (self , value : Iterable [_T ], / ) -> Self : ... # type: ignore[misc]
1145
1146
def __mul__ (self , value : SupportsIndex , / ) -> list [_T ]: ...
1146
1147
def __rmul__ (self , value : SupportsIndex , / ) -> list [_T ]: ...
0 commit comments