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: ...
https://mypy-play.net/?mypy=latest&python=3.10&gist=736b946030f3c52e14c712ce7e95464c
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.
Given this code:
https://mypy-play.net/?mypy=latest&python=3.10&gist=736b946030f3c52e14c712ce7e95464c
mypy 0.981 reports
main.py:13: error: Signature of "f" incompatible with supertype "A".This is incorrect:
Bis anA[int], so it doesn't matter that it doesn't implement the second overload.