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

Do not emit incorrect linting warnings #5491

Merged

Conversation

keyboardDrummer
Copy link
Member

Description

  • Do not emit linting warnings about line breaks that occur between parenthesis, since these are not confusing.

How has this been tested?

  • Updated existing test

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@keyboardDrummer keyboardDrummer enabled auto-merge (squash) May 27, 2024 09:54
RustanLeino
RustanLeino previously approved these changes May 28, 2024
@@ -7,6 +7,7 @@
//-----------------------------------------------------------------------------

using System.Linq;
using System.Security.AccessControl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this needed?

Comment on lines -164 to -167
} else if (expr is FunctionCallExpr functionCallExpr) {
return VisitComponentsAsIndependentExceptOne(expr, functionCallExpr.Receiver, st);
} else if (expr is ApplyExpr applyExpr) {
return VisitComponentsAsIndependentExceptOne(expr, applyExpr.Function, st);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we no longer expect DatatypeValue and FunctionCallExpr to ever arise at this time, then:

  • We could still look for them and do a Contract.Assert(false); (or something similar) if they ever occur.
  • Is VisitComponentAsIndependentExceptOne now unused?

Copy link
Member Author

@keyboardDrummer keyboardDrummer May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could still look for them and do a Contract.Assert(false); (or something similar) if they ever occur.

Any resolution only type is unexpected, since this code runs before resolution now. I don't think it makes sense to look for all resolution-only types and assert false. To be honest, I do not think this file should refer to any AST constructs. Each parsed construct should declare all its grammar specific properties, including what is needed for this linting warning.

Is VisitComponentAsIndependentExceptOne now unused?

No it's still used.

Comment on lines -21 to -23
PrecedenceLinter.dfy(401,43): Warning: unusual indentation in right-hand operand of ==> (which ends at line 402, column 11); do you perhaps need parentheses?
PrecedenceLinter.dfy(403,43): Warning: unusual indentation in right-hand operand of ==> (which ends at line 404, column 11); do you perhaps need parentheses?
PrecedenceLinter.dfy(431,11): Warning: unusual indentation in else branch of if-then-else (which ends at line 434, column 6); do you perhaps need parentheses?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!

@keyboardDrummer keyboardDrummer merged commit 9a53670 into dafny-lang:master May 30, 2024
21 checks passed
@keyboardDrummer keyboardDrummer deleted the precedenceLinterFix branch May 30, 2024 16:28
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.

None yet

2 participants