We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request Extend feature added in #424 to allow subclasses to also specialize method parameters that contain Union type.
Union
Code example
class A(): def x(self, x: Union[Dict, List]): pass class B(A): def x(self, x: Dict): pass
mypy output error: Argument 1 of "x" incompatible with supertype "A"
error: Argument 1 of "x" incompatible with supertype "A"
Expected output Nothing :)
mypy/python version mypy 0.641 Python 3.6.7
The text was updated successfully, but these errors were encountered:
I think this issue is mistaken. The contract of A states "all A classes contain method x that accepts argument Union[Dict, List]".
Union[Dict, List]
The method B.x violates that contract because it does not accept List.
List
Sorry, something went wrong.
This is basically duplicate of #1237.
Yeah, the method in B violates Liskov substitution principle (https://en.wikipedia.org/wiki/Liskov_substitution_principle).
B
No branches or pull requests
Feature Request
Extend feature added in #424 to allow subclasses to also specialize method parameters that contain
Union
type.Code example
mypy output
error: Argument 1 of "x" incompatible with supertype "A"
Expected output
Nothing :)
mypy/python version
mypy 0.641
Python 3.6.7
The text was updated successfully, but these errors were encountered: