-
Notifications
You must be signed in to change notification settings - Fork 269
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
Improve error message locations for function calls and call arguments #6009
Improve error message locations for function calls and call arguments #6009
Conversation
Can you please clarify the following example: assert !Even(N(17));
^ new location
^ previous location
// Error: assertion might not hold I think that, in the case of negation, the error location cannot be anywhere else than the negation operator. |
@@ -0,0 +1,2 @@ | |||
Contains various scripts for developing Dafny. New scripts can be added by adding System.CommandLine commands. | |||
You can invoke these scripts using `dotnet run --project Source/Scripts <command-name> <command-arguments>` |
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.
It think it's a great idea.
Could you please add a section about the supported commands as well and briefly what they do?
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.
You can get that documentation by running dotnet run --project Source/Scripts/Scripts.csproj -- --help
:
Description:
Various scripts that help develop Dafny
Usage:
Scripts [command] [options]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
update-expect-files <fileinfo> Use the 'log archive' file downloaded from CI to update the integration tests
and you can do:
% dotnet run --project Source/Scripts/Scripts.csproj -- update-expect-files --help
Description:
Use the 'log archive' file downloaded from CI to update the integration tests
Usage:
Scripts update-expect-files <fileinfo> [options]
Arguments:
<fileinfo>
Options:
-?, -h, --help Show help and usage information
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. It would be great if you could make this command available on the main makefile, like make script name=X
or similar.
That's because of how splitting of case UnaryOpExpr opExpr: {
var e = opExpr;
if (e.ResolvedOp == UnaryOpExpr.ResolvedOpcode.BoolNot) {
var ss = new List<SplitExprInfo>();
if (TrSplitExpr(context, e.E, ss, !position, heightLimit, applyInduction, etran)) {
foreach (var s in ss) {
splits.Add(ToSplitExprInfo(s.Kind, Bpl.Expr.Unary(s.E.tok, UnaryOperator.Opcode.Not, s.E)));
^ note the 's.E.tok' in the above line.
}
return true;
}
}
break;
} So |
Oh I better understand thanks to this example. I did not think of splitting. Thanks for the investigation and the precise details. Could you please replace this
by
? |
But then we're being inconsistent between different logical operators in how we handle splits. Also, I don't think there would be a regression because we're currently not reporting on the Here's the actual change: assert !Even(N(17));
^^^^|^^^^^^ new diagnostic location
|^^^ previous diagnostic location
// Error: assertion might not hold I'm happy to make the update you describe, but then let's do it for all operators and in a follow-up PR. |
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.
Ok if it's not a regression, let's go for it. Happy to review another PR to fix this8 split error positioning.
@@ -0,0 +1,2 @@ | |||
Contains various scripts for developing Dafny. New scripts can be added by adding System.CommandLine commands. | |||
You can invoke these scripts using `dotnet run --project Source/Scripts <command-name> <command-arguments>` |
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. It would be great if you could make this command available on the main makefile, like make script name=X
or similar.
What was changed?
Added a method for updating test expect files based on CI output. This is contained in the C# project
Scripts
Call arguments
Errors that relate to call arguments are reported on the argument, instead of on the
(
.Example:
Function calls
Errors that relate to function or method calls are now consistently reported on the
(
. This was already done for method calls, while for function calls the error was reported on the center of the callee expression. It's better to report on the(
, to distinguish from errors in computing the callee, which are reported on the center of the callee expression.Example:
Assertions
Currently, errors about assertions (assert/ensure/invariant) are reported on the center of the condition. Since this PR changes the center of expressions that call functions, the locations for 'assertion might not hold' can change as well. Example:
Another example:
How has this been tested?
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.