summaryrefslogtreecommitdiff
path: root/Test/dafny0/ResolutionErrors.dfy
diff options
context:
space:
mode:
Diffstat (limited to 'Test/dafny0/ResolutionErrors.dfy')
-rw-r--r--Test/dafny0/ResolutionErrors.dfy17
1 files changed, 8 insertions, 9 deletions
diff --git a/Test/dafny0/ResolutionErrors.dfy b/Test/dafny0/ResolutionErrors.dfy
index 77a30102..5ec0cc4c 100644
--- a/Test/dafny0/ResolutionErrors.dfy
+++ b/Test/dafny0/ResolutionErrors.dfy
@@ -1,20 +1,19 @@
-method UmmThisIsntGoingToWork()
+
+//Should not verify, as ghost loops should not be allowed to diverge.
+method GhostDivergentLoop()
{
var a := new int [2];
- var b := new int [1];
a[0] := 1;
a[1] := -1;
-
ghost var i := 0;
while (i < 2)
- decreases *; // error: not allowed on a ghost loop
- invariant i <= 2;
- invariant forall j :: 0 <= j && j < i ==> a[j] > 0;
+ decreases *; // error: not allowed on a ghost loop
+ invariant i <= 2;
+ invariant (forall j :: 0 <= j && j < i ==> a[j] > 0);
{
- i := 0;
+ i := 0;
}
- assert a[1] == -1; // ...for then this would incorrectly verify
- b[a[1]] := 0;
+ assert a[1] != a[1]; // ...for then this would incorrectly verify
}
method M<T>(a: array3<T>, b: array<T>, m: int, n: int)