diff options
author | leino <unknown> | 2014-12-12 20:46:48 -0800 |
---|---|---|
committer | leino <unknown> | 2014-12-12 20:46:48 -0800 |
commit | 91c4d57eb84d5d15e011902a1da1b70131e5a222 (patch) | |
tree | 6794bafdc71f6bc31c8d09496c3435658bbfc144 /Test/dafny0/RefinementModificationChecking.dfy | |
parent | 62a3e97eb61cbee0d523297ccad1f2d3bcf871c3 (diff) |
Language change: All functions and methods declared lexically outside any class are now
automatically static, and fields are no longer allowed to be declared there. Stated
differently, all heap state must now be declared inside an explicitly declared class,
and functions and methods declared outside any class can be viewed as belonging to
the module. The motivating benefit of this change is to no longer need the 'static'
keyword when declaring a module of functions and methods.
Diffstat (limited to 'Test/dafny0/RefinementModificationChecking.dfy')
-rw-r--r-- | Test/dafny0/RefinementModificationChecking.dfy | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/Test/dafny0/RefinementModificationChecking.dfy b/Test/dafny0/RefinementModificationChecking.dfy index 70d0b989..052918d0 100644 --- a/Test/dafny0/RefinementModificationChecking.dfy +++ b/Test/dafny0/RefinementModificationChecking.dfy @@ -2,25 +2,29 @@ // RUN: %diff "%s.expect" "%t"
abstract module R1 {
- var f: int;
- method m(y: set<int>) returns (r: int)
- modifies this;
- {
- var t := y;
+ class HappyBay {
+ var f: int;
+ method m(y: set<int>) returns (r: int)
+ modifies this;
+ {
+ var t := y;
+ }
}
}
module R2 refines R1 {
- var g: nat;
- method m ...
- {
- ...;
- var x := 3;
- t := {1}; // error: previous local
- r := 3; // error: out parameter
- f := 4; // error: previously defined field
- x := 6; // fine: new local
- g := 34;// fine: new field
+ class HappyBay {
+ var g: nat;
+ method m ...
+ {
+ ...;
+ var x := 3;
+ t := {1}; // error: previous local
+ r := 3; // error: out parameter
+ f := 4; // error: previously defined field
+ x := 6; // fine: new local
+ g := 34;// fine: new field
+ }
}
}
|