-
Notifications
You must be signed in to change notification settings - Fork 262
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: Formatting within the IDE wasn't working anymore #4274
Conversation
@@ -323,6 +323,8 @@ public enum AccumulationOperand { None, Left, Right } | |||
if (cloner.CloneResolvedFields) { | |||
ResolvedOp = original.ResolvedOp; | |||
} | |||
|
|||
RangeToken = original.rangeToken; |
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.
The call to base already does RangeToken = cloner.Range(original.RangeToken);
, so this line seems obsolete
@@ -101,6 +102,22 @@ public class Method : MemberDecl, TypeParameter.ParentType, IMethodCodeContext, | |||
Contract.Invariant(Decreases != null); | |||
} | |||
|
|||
public Method(Cloner cloner, Method m) : base(cloner, m) { |
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.
Could you rename m
to original
?
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 great, just one request for change :)
…lang/dafny into fix-4269-format-lemma-ide
This PR fixes #4269 and fixes #4270
I first added unit tests for the cases that were failing. What really solved the issue was that I had to implement proper cloning for
Then I also added for all formatting test a case when it tries to clone all members before formatting, like VSCode does, which unveiled 3 more formatting issues:
I also solved the above issues by:
RangeToken
ofTypeRHS
is preserved after cloning by modifying its topmost cloning parentAssignmentRHS
OwnedToken
(otherwise some cloned expressions were crashing)UnchangedExpr
is cloned with the same pattern as everyone else (otherwise theRangeToken
wasn't kept)By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.