Say we have a class Foo:
classFoo:
@overloaddeffun(self, s:str) ->str:
pass@overloaddeffun(self, i:int) ->int:
passdeffun(self, x):
pass
If we now add a subclass Bar like this:
classBar(Foo):
@overloaddeffun(self, s:str) ->str:
pass@overloaddeffun(self, i:int) ->int:
passdeffun(self, x):
passBar().fun([])
and run mypy on it without any flags, we get the expected
error: No overload variant of "fun" of "Bar" matches argument type "List[<nothing>]".
If however we don't copy the overloaded signatures,
classBar(Foo):
deffun(self, x):
passBar().fun([])
then mypy does not find any errors. Is this inteded behaviour? Is it not possible to find the overloaded signatures of the base classes statically? Am I not supposed to do this sort of thing in the first place?
> python -V
Python 3.6.2
> mypy -V
mypy 0.610+dev-eb1bb064d707ce05735ff6795df82126e75ea6ea
Say we have a class
Foo:If we now add a subclass
Barlike this:and run mypy on it without any flags, we get the expected
error: No overload variant of "fun" of "Bar" matches argument type "List[<nothing>]".If however we don't copy the overloaded signatures,
then mypy does not find any errors. Is this inteded behaviour? Is it not possible to find the overloaded signatures of the base classes statically? Am I not supposed to do this sort of thing in the first place?