Skip to content

Removes incorrect override check on overloaded methods #4810

New issue

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

Conversation

Michael0x2a
Copy link
Collaborator

This commit fixes #4565

Currently, when we override a method and annotate the implementation, mypy appears to check the legality of the override twice: once for the overloads, and once for the implementation.

This second check is unnecessary and causes a spurious error.

This commit fixes python#4565

Currently, when we override a method and annotate the implementation,
mypy appears to check the legality of the override twice: once for
the overloads, and once for the implementation.

This second check is unnecessary and causes a spurious error.
Copy link
Collaborator

@msullivan msullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually add a test where overloaded types are actually incompatible and this generates "Incompatible with supertype error". It looks like we only have few such tests for stubs, not for source files where implementation is required.

@Michael0x2a
Copy link
Collaborator Author

@ilevkivskyi I added another test -- let me know if you think I should add more.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ilevkivskyi ilevkivskyi merged commit 8100581 into python:master Mar 28, 2018
@Michael0x2a Michael0x2a deleted the fix-bad-overload-implementation-signature-check branch July 9, 2018 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Function overloading example does not typecheck
3 participants