summaryrefslogtreecommitdiff
path: root/Chalice/tests/predicates/unfolding.chalice
blob: 6b276a047a0e6963217f6f2c8b2cebdcc71e8c1d (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
26
27
28
29
30
31
32
class Cell {
  var value: int;
  
  predicate p { acc(value) }
  
  method test()
    requires p
  {
    var tmp: int := unfolding p in value;
    var tmp2: int := unfolding p in value;
    call void()
    assert tmp == unfolding p in value // ERROR: should fail
  }
  
  method test2()
    requires p
    ensures p
  {
    var tmp: int := unfolding p in value;
    var tmp2: int := unfolding p in value;
    call v()
    assert tmp == unfolding p in value
  }
  
  method v() requires true {}
  
  method void()
    requires p
    ensures p
  {}
  
}