Open
Description
The following does not seem to work:
from typing import overload
class Example:
@overload
def fun(self, p: int) -> int: ...
@overload
def fun(self, p: str) -> str: ...
def fun(self, p=1):
if isinstance(p, int):
return 'foo'
else:
return 'bar'
prop = property(fun)
Argument 1 to "property" has incompatible type overloaded function; expected "Optional[Callable[[Any], Any]]"
Is this a bug or expected?
Also, fun(0)
returns a string instead of an int as specified in the stub, but mypy doesn't seem to catch this. Again, bug or expected?