summaryrefslogtreecommitdiff
path: root/Test/dafny0/RefinementErrors.dfy
diff options
context:
space:
mode:
authorGravatar leino <unknown>2015-07-31 16:43:34 -0700
committerGravatar leino <unknown>2015-07-31 16:43:34 -0700
commita8953bef9bebfaa4afb56a914060360c7453e8b8 (patch)
treeb449f202c8bf184d284aa686480b4c8d9ce59212 /Test/dafny0/RefinementErrors.dfy
parent2b2050060b9eb8cb123af6df942ebebe7fe6d52c (diff)
Allow forall statements in refinements
Diffstat (limited to 'Test/dafny0/RefinementErrors.dfy')
-rw-r--r--Test/dafny0/RefinementErrors.dfy37
1 files changed, 37 insertions, 0 deletions
diff --git a/Test/dafny0/RefinementErrors.dfy b/Test/dafny0/RefinementErrors.dfy
index 121b33aa..8d60a8e4 100644
--- a/Test/dafny0/RefinementErrors.dfy
+++ b/Test/dafny0/RefinementErrors.dfy
@@ -59,3 +59,40 @@ module BB refines B {
{ 10 }
}
}
+
+module Forall0 {
+ class C {
+ var a: int
+ method M()
+ modifies this
+ {
+ }
+ lemma Lemma(x: int)
+ {
+ }
+ }
+}
+module Forall1 refines Forall0 {
+ class C {
+ var b: int
+ method M...
+ {
+ forall x { Lemma(x); } // allowed
+ var s := {4};
+ forall x | x in s ensures x == 4 { } // allowed
+ forall x { // allowed
+ calc {
+ x in s;
+ ==
+ x == 4;
+ }
+ }
+ forall c | c in {this} {
+ c.b := 17; // allowed
+ }
+ forall c | c in {this} {
+ c.a := 17; // error: not allowed to update previously defined field
+ }
+ }
+ }
+}