-
Notifications
You must be signed in to change notification settings - Fork 285
Closed
Labels
area: error-reportingClarity of the error reportingClarity of the error reportingkind: enhancementEnhancements, feature requests, etc. These are NOT bugs, but ways we can improve DafnyEnhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafnypriority: not yetWill reconsider working on this when we're looking for workWill reconsider working on this when we're looking for work
Description
Consider these two equivalent programs:
function method fIncorrectInOneCase(x: int) : (y: int)
ensures y > 0
{
if (x < -3) then 5
else if (x < 5) then -2
else 4
}
method mIncorrectInOneCase(x: int) returns (y: int)
ensures y > 0
{
if (x < -3) { return 5; }
else if (x < 5) { return -2; }
else { return 4; }
}Here's Dafny's output:
The error is correctly positioned in the method, but not in the function. This makes debugging function methods much less pleasant than methods.
Here's the textual output:
test.dfy(1,16): Error: A postcondition might not hold on this return path.
test.dfy(2,12): Related location: This is the postcondition that might not hold.
Execution trace:
(0,0): anon0
(0,0): anon9_Else
(0,0): anon10_Else
(0,0): anon11_Then
(0,0): anon8
test.dfy(13,20): Error: A postcondition might not hold on this return path.
test.dfy(10,12): Related location: This is the postcondition that might not hold.
Execution trace:
(0,0): anon0
(0,0): anon5_Else
(0,0): anon6_Then
Btw, what's up with line numbers in execution traces?
Metadata
Metadata
Assignees
Labels
area: error-reportingClarity of the error reportingClarity of the error reportingkind: enhancementEnhancements, feature requests, etc. These are NOT bugs, but ways we can improve DafnyEnhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafnypriority: not yetWill reconsider working on this when we're looking for workWill reconsider working on this when we're looking for work
