-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Optionally check that we don't have duplicate nodes after AST merge #4647
Conversation
Currently this will actually find many duplicate nodes. I will fix these issues in separate PRs after this has been merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, modulo the type error
mypy/server/mergecheck.py
Outdated
if t in ('dict', 'tuple', 'SymbolTable', 'list'): | ||
result += '[%s]' % repr(attr) | ||
else: | ||
if t == 'Var': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy doesn't like this because it doesn't know about the type.
What's the reason for doing this based on the name of the type instead of the type?
* 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)
…ython#4647) It's hard to manually ensure that all relevant nodes are merged in AST merge and that no references to stale objects remain. This automated opt-in check looks for these duplicate nodes. It can be enabled in tests by switching `mypy.test.testfinegrained.CHECK_CONSISTENCY` to True. This was originally implemented by @msullivan. I did various minor changes and some refactoring.
It's hard to manually ensure that all relevant nodes are merged in AST merge
and that no references to stale objects remain. This automated opt-in check
looks for these duplicate nodes. It can be enabled in tests by switching
mypy.test.testfinegrained.CHECK_CONSISTENCY
to True.This was originally implemented by @msullivan. I did various minor changes
and some refactoring.