Closed
Description
Given this code:
from typing import overload, TypeVar, Generic
T = TypeVar("T", str, int)
class A(Generic[T]):
@overload
def f(self: A[int]) -> int: ...
@overload
def f(self: A[str]) -> str: ...
def f(self): ...
class B(A[int]):
def f(self) -> int: ...
mypy 0.981 reports main.py:13: error: Signature of "f" incompatible with supertype "A"
.
This is incorrect: B
is an A[int]
, so it doesn't matter that it doesn't implement the second overload.