-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
The handling of @overload
decorators happens in (code) blocks only, which makes it not find the implementation when using:
from typing import overload
from typing import TYPE_CHECKING
from typing import Union
class K:
if TYPE_CHECKING:
@overload
def foo(self, arg: int) -> int:
...
@overload
def foo(self, arg: str) -> str:
...
def foo(self, arg: Union[int, str]) -> Union[int, str]:
...
t-overload.py:8: error: An overloaded function outside a stub file must have an implementation [misc]
t-overload.py:16: error: Name 'foo' already defined on line 8 [no-redef]
Found 2 errors in 1 file (checked 1 source file)
I think it would be nice / feasible to merge if TYPE_CHECKING
blocks maybe, so that the parser would handle it together?
mypy 0.800+dev.6e99a2db100d794b1bf900746470527cd03fce16
cdce8p and fohrloop
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong