-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
Say we have a class Foo:
class Foo:
@overload
def fun(self, s:str) -> str:
pass
@overload
def fun(self, i:int) -> int:
pass
def fun(self, x):
passIf we now add a subclass Bar like this:
class Bar(Foo):
@overload
def fun(self, s:str) -> str:
pass
@overload
def fun(self, i:int) -> int:
pass
def fun(self, x):
pass
Bar().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,
class Bar(Foo):
def fun(self, x):
pass
Bar().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
Metadata
Metadata
Assignees
Labels
No labels