Skip to content
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

Merged
merged 8 commits into from
Feb 28, 2018

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Feb 27, 2018

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.

@JukkaL JukkaL requested a review from msullivan February 27, 2018 16:47
@JukkaL
Copy link
Collaborator Author

JukkaL commented Feb 27, 2018

Currently this will actually find many duplicate nodes. I will fix these issues in separate PRs after this has been merged.

Copy link
Collaborator

@msullivan msullivan left a 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

if t in ('dict', 'tuple', 'SymbolTable', 'list'):
result += '[%s]' % repr(attr)
else:
if t == 'Var':
Copy link
Collaborator

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?

@JukkaL JukkaL merged commit 8a4f85e into master Feb 28, 2018
@msullivan msullivan deleted the mergecheck2 branch February 28, 2018 20:12
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
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants