summaryrefslogtreecommitdiff
path: root/Test/dafny0/ResolutionErrors.dfy
diff options
context:
space:
mode:
authorGravatar leino <unknown>2014-08-20 20:26:08 -0700
committerGravatar leino <unknown>2014-08-20 20:26:08 -0700
commita570ecd2d288f67a9e56faf4421a447d06b21d36 (patch)
treed333228b3ece459feb1ef207fb7628dce16e38bd /Test/dafny0/ResolutionErrors.dfy
parent61d55705cdf6a710f1a21ddb2ae2caaa314ca7f6 (diff)
parentbc5ba2bcd7fb7de092898100e08edecf9f0a00e1 (diff)
Merge
Diffstat (limited to 'Test/dafny0/ResolutionErrors.dfy')
-rw-r--r--Test/dafny0/ResolutionErrors.dfy38
1 files changed, 38 insertions, 0 deletions
diff --git a/Test/dafny0/ResolutionErrors.dfy b/Test/dafny0/ResolutionErrors.dfy
index e0c37e2a..3c9156dd 100644
--- a/Test/dafny0/ResolutionErrors.dfy
+++ b/Test/dafny0/ResolutionErrors.dfy
@@ -1121,3 +1121,41 @@ method IntegerDivision(s: set<bool>)
{
var t := s / s; // error: / cannot be used with sets
}
+
+// ----- decreases * tests ----
+
+method NonTermination_A()
+{
+ NonTermination_B(); // error: to call a non-terminating method, the caller must be marked 'decreases *'
+}
+
+method NonTermination_B()
+ decreases *;
+{
+ while true
+ decreases *;
+ {
+ }
+}
+
+method NonTermination_C()
+{
+ while true
+ decreases *; // error: to use an infinite loop, the enclosing method must be marked 'decreases *'
+ {
+ }
+}
+
+method NonTermination_D()
+ decreases *;
+{
+ var n := 0;
+ while n < 100 // note, no 'decreases *' here, even if the nested loop may fail to terminate
+ {
+ while *
+ decreases *;
+ {
+ }
+ n := n + 1;
+ }
+}