Mypy errors with Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [misc] for the following class:
from typing import Optional, Union, overload
class Transform:
@overload
def apply(self, b: bytes) -> bytes:
"""Return the transformed bytestring of the input"""
@overload
def apply(self, b: bytearray) -> None:
"""Transform the input bytearray in place"""
def apply(self, b: Union[bytes, bytearray]) -> Optional[bytes]:
pass
Changing the order of the two @overload doesn't give the error.
mypy --version
mypy 0.981 (compiled: yes)
Mypy errors with
Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [misc]for the following class:Changing the order of the two
@overloaddoesn't give the error.