summaryrefslogtreecommitdiff
path: root/Test/dafny0
diff options
context:
space:
mode:
authorGravatar Rustan Leino <unknown>2015-07-31 17:10:52 -0700
committerGravatar Rustan Leino <unknown>2015-07-31 17:10:52 -0700
commit0e19afae5ecfa6d8106fe5bda40f9656a29cc598 (patch)
tree6a53774f09757d160d0de90eeabdca4199250786 /Test/dafny0
parentd023b0e19f7bf886801a3a059511b8449d8ab223 (diff)
parent9cf3281f6b64c9824e9a47b2ef932b8b113ecbc8 (diff)
Merge
Diffstat (limited to 'Test/dafny0')
-rw-r--r--Test/dafny0/RefinementErrors.dfy37
-rw-r--r--Test/dafny0/RefinementErrors.dfy.expect3
2 files changed, 39 insertions, 1 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
+ }
+ }
+ }
+}
diff --git a/Test/dafny0/RefinementErrors.dfy.expect b/Test/dafny0/RefinementErrors.dfy.expect
index 40cdb081..bac6612d 100644
--- a/Test/dafny0/RefinementErrors.dfy.expect
+++ b/Test/dafny0/RefinementErrors.dfy.expect
@@ -9,4 +9,5 @@ RefinementErrors.dfy(38,13): Error: type parameters are not allowed to be rename
RefinementErrors.dfy(39,23): Error: the type of parameter 'z' is different from the type of the same parameter in the corresponding function in the module it refines ('seq<C>' instead of 'set<C>')
RefinementErrors.dfy(40,9): Error: there is a difference in name of parameter 3 ('k' versus 'b') of function F compared to corresponding function in the module it refines
RefinementErrors.dfy(57,20): Error: a function can be changed into a function method in a refining module only if the function has not yet been given a body: G
-11 resolution/type errors detected in RefinementErrors.dfy
+RefinementErrors.dfy(94,10): Error: refinement method cannot assign to a field defined in parent module ('a')
+12 resolution/type errors detected in RefinementErrors.dfy