summaryrefslogtreecommitdiff
path: root/Test/dafny0/RefinementModificationChecking.dfy
blob: 34e30a0512e9ab56212e22d203ec41935717062b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

abstract module R1 {
  var f: int;
  method m(y: set<int>) returns (r: int)
    modifies this;
  {
    var t := y;
  }
}

abstract module R2 refines R1 {
  var g: nat;
  method m ...
  {
    ...;
    var x := 3;
    t := {1}; // error: previous local
    r := 3; // error: out parameter
    f := 4; // fine: all fields, will cause re-verification
    x := 6; // fine: new local
    g := 34;// fine: new field
  }
}