mypy
mypy copied to clipboard
(🐞) Warn when overload impl default value is incompatible with overload part default value
from typing import overload
@overload
def f(x: object): ...
@overload
def f(x: int = ...): ...
def f(x: object = ""): ...
While this code is type-safe, it's almost certainly a mistake. The default value of overload part 2 is never going to be met by the implementation.
- related: https://github.com/python/mypy/issues/11397, but I think this issue is actually the same issue, just in a more generic form.