New semantic analyser: Fix special attrs decorators#7083
Merged
ilevkivskyi merged 2 commits intopython:masterfrom Jun 27, 2019
Merged
New semantic analyser: Fix special attrs decorators#7083ilevkivskyi merged 2 commits intopython:masterfrom
ilevkivskyi merged 2 commits intopython:masterfrom
Conversation
JukkaL
approved these changes
Jun 27, 2019
Collaborator
JukkaL
left a comment
There was a problem hiding this comment.
This looks like a good fix, since this makes each iteration behave more similarly. I only have one comment about possible new test cases (up to you).
|
|
||
| reveal_type(B) # N: Revealed type is 'def (x: Any) -> __main__.B' | ||
| [builtins fixtures/list.pyi] | ||
|
|
Collaborator
There was a problem hiding this comment.
Can you check that there are tests that run multiple semantic passes with various kinds of decorators? There is a small risk that this might break something.
Member
Author
There was a problem hiding this comment.
I run all test cases where top-levels processed twice (second time gives an extra iteration). I have found no failures related to this change. I however added another attrs specific decorator test case just in case.
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 #6953
I first thought about actually not modifying them in
attrsplugin, but this is non-trivial, plus there are few places apart from the plugin where we modify decorators. So for now I just restore them after each iteration (in the same way we do this for overloads and other things).