-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-hightopic-overloads
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
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-0-hightopic-overloads