-
Notifications
You must be signed in to change notification settings - Fork 285
Fix a bug related to abstract imports and match expressions #5811
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
Fix a bug related to abstract imports and match expressions #5811
Conversation
| Alternatively, we could call all the rewriter.PostResolve methods | ||
| */ | ||
|
|
||
| new MatchFlattener(reporter).PostResolve(module); |
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.
This added line is the only semantic change in this PR
…dafny into unreachabelExprToBoogie
| void AfterNodeChildren() => afterChildren(currentNode); | ||
| toVisit.AddFirst((Action)AfterNodeChildren); |
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.
Nice fix, funny how simple and clean the original looks while also being completely wrong. :)
| Cloning with resolved fields is not an option, | ||
| because then internal references of the cloned code can point to the old code. | ||
| I(keyboardDrummer) think it would be better altogether if no cloning was done for abstract modules, |
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.
Out of curiosity what alternative do you imagine? Given the semantics of abstract modules are so close to the idea of making copies of the code, could the better path be doubling-down on clone testing? I don't feel like cloning is going away any time soon.
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.
Whatever operation you want to do on both the abstract module and the original module, where the two should behave mostly the same but somewhat differently, pass in a context object that allows you to differentiate between the two scenarios.
Given that I don't understand the code related to abstract modules, I would probably find related tests, reimplement without copying and see what breaks.
Fixes #5808
Description
new MatchFlattener(reporter).PostResolve(module);after cloning elements for abstract imports, so.Flattenedis set.afterChildrenparameter inNode.Visit, so that closure is actually only called after the children are visited.How has this been tested?
Added a CLI test
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.