Closed
Description
With the following example:
from typing import Callable, Generic, Type, TypeVar
XType = TypeVar('XType', bound=int)
class C(Generic[XType]):
def f(self, x_init: XType) -> XType:
return x_init
def combinator(c_cls: Type[C[XType]]) -> Callable[[C[XType], XType], XType]:
old_f = c_cls.f
def new_f(c: C[XType], x_init: XType) -> XType:
return old_f(c, x_init)
return new_f
MyPy 0.910 says:
a.py:15: error: Incompatible return value type (got "XType", expected "XType")
a.py:15: error: Argument 1 has incompatible type "C[XType]"; expected "C[XType]"
a.py:15: error: Argument 2 has incompatible type "XType"; expected "XType"