Repository navigation
Support decorated constructors - #6645
Merged
Merged
Conversation
Member
|
I'm sorry, I don't think I can review this. |
msullivan
approved these changes
Apr 11, 2019
| """Does this node represents a valid constructor method? | ||
|
|
||
| def type_object_type_from_function(init_or_new: FuncBase, | ||
| This includes nomral functions, overloaded functions, and decorators |
| else: | ||
| assert isinstance(method.type, FunctionLike) # is_valid_constructor() ensures this | ||
| t = method.type | ||
| signature = bind_self(t) |
Collaborator
There was a problem hiding this comment.
Any particular reason for moving this bind_self out of type_object_type_from_function? I don't have any objection, I'm just wondering if there is a technical reason I'm missing or you just like it more.
Member
Author
There was a problem hiding this comment.
No particular reason. I think I started refactoring by pulling function_type() out of there, and pulled whole line out of there. But looking again at it I think it makes sense to keep bind and map together, so I will put it back.
Member
Author
Not so much actually, around 60 errors S+C. |
Merged
ilevkivskyi
pushed a commit
that referenced
this pull request
Apr 27, 2019
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1706
Fixes #5398
Previously, decorated constructors either resulted in silent
Anytypes for class objects (in case of a decorated__init__()) or incorrect signatures (in case of a decorated__new__()).This PR adds support for decorated constructors, implementation is straightforward.
This PR supersedes #5798.