Conversation
Also process overloaded and non-overloaded functions more consistently in AST merge.
They can appear in UnboundType instances.
Not sure yet if this actually fixes any user-visible issues.
There were two issues: * The `info` attribute of the corresponding `ClassDef` wasn't updated. * `FuncDef` objects within the related `TypeInfo` weren't processed, since they are only accessible through a symbol table. Functions in normal classes are accessible by traversing the AST, in contrast.
This could at least leak memory. Not sure if this could cause invalid type checking results.
The type map could contain stale references to AST nodes.
Not sure if this is necessary but it might be.
The relevant nodes won't be exposed externally.
msullivan
approved these changes
Mar 1, 2018
Collaborator
msullivan
left a comment
There was a problem hiding this comment.
Looks great!
What is the one remaining failure?
mypy/types.py
Outdated
| [arg, ...] in Callable[[arg, ...], ret]. This is not a real type | ||
| but a syntactic AST construct. | ||
| but a syntactic AST construct. UnboundTypes can also have TypeList | ||
| types before they are processed into Callable type.s |
| def visit_forwardref_type(self, t: ForwardRef) -> T: | ||
| raise RuntimeError('Internal error: unresolved forward reference') | ||
|
|
||
| def visit_type_list(self, t: TypeList) -> T: |
Collaborator
There was a problem hiding this comment.
Can other sorts of "synthetic" types show up in our traversal?
Would it be a better approach in the future to make the merger a synthetic type traverser?
Collaborator
Author
There was a problem hiding this comment.
Hmm looks like we could be hitting other such types as well. Maybe making it a "synthetic type visitor" is the right thing to do. I'll consider making a follow-up PR about this.
On the other hand, we should perhaps only have one sort of type visitor. I don't really see the benefit of having two sorts of visitors.
Collaborator
Author
|
The remaining failure is |
carljm
added a commit
to carljm/mypy
that referenced
this pull request
Mar 6, 2018
* master: New files shouldn't trigger a coarse-grained rebuild in fg cache mode (python#4669) Bump version to 0.580-dev Update revision history for 0.570 (python#4662) Fine-grained: Fix crashes when refreshing synthetic types (python#4667) Fine-grained: Support NewType and reset subtype caches (python#4656) Fine-grained: Detect changes in additional TypeInfo attributes (python#4659) Fine-grained: Apply semantic analyzer patch callbacks (python#4658) Optimize fine-grained update by using Graph as the cache (python#4622) Cleanup check_reverse_op_method (python#4017) Fine-grained: Fix AST merge issues (python#4652) Optionally check that we don't have duplicate nodes after AST merge (python#4647)
yedpodtrzitko
pushed a commit
to kiwicom/mypy
that referenced
this pull request
Mar 15, 2018
This fixes all but one AST merge checker test failures. The remaining one (testFineGrainedCallable) seems tricky to fix so I'll leave it for later. I decided not to add tests for things that can be caught using the merge checker. We'll have to run the merge checker periodically since it's not enabled by default in the test suite.
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.
This fixes all but one AST merge checker test failures. The remaining
one seems tricky to fix so I'll leave it for later.
I decided not to add tests for things that can be caught using the
merge checker. We'll have to run the merge checker periodically
since it's not enabled by default in the test suite.