Closed
Description
The revealed type for the following program is List[Any]
, while the correct type would be Any
-- looks like the wrong overload item is picked:
from typing import Any, List
i: Any
a: List[Any]
reveal_type(a[i]) # List[Any], but should be Any
Here is a self-contained repro:
from typing import Any, overload, TypeVar, Generic
T = TypeVar('T')
class A(Generic[T]):
@overload
def f(self, x: int) -> T: ...
@overload
def f(self, x: slice) -> A[T]: ...
def f(self, x): ...
i: Any
a: A[Any]
reveal_type(a.f(i)) # A[Any], but should be Any