-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow any more general type for override of a method (#1524)
This is a prerequisite for fixing #1261 because overrides with generic function type variables currently work by accident: the type variables have the same ids in the original method and the overriding method, so is_subtype on the argument type returns True. This also allows an overriding method to generalize a specific type in the original method to a type variable, as demonstrated in one of the tests (testOverrideGenericMethodInNonGenericClassGeneralize). is_subtype already determines correctly whether the override is valid, so all the hard work here is in providing a more specific error message when possible.
- Loading branch information
Showing
3 changed files
with
96 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters