File tree 2 files changed +32
-5
lines changed
src/test/resources/all/issues/carbon
2 files changed +32
-5
lines changed Original file line number Diff line number Diff line change 1
- // Any copyright is dedicated to the Public Domain.
2
- // http://creativecommons.org/publicdomain/zero/1.0/
3
-
1
+ // Any copyright is dedicated to the Public Domain.
2
+ // http://creativecommons.org/publicdomain/zero/1.0/
3
+
4
4
field f: Int
5
5
6
6
predicate P(self: Ref) { acc(self.f) }
@@ -16,8 +16,6 @@ method test(x: Ref, y: Ref)
16
16
{
17
17
i := i + 1;
18
18
}
19
- //:: UnexpectedOutput(assert.failed:assertion.false, /carbon/issue/259/)
20
19
assert (unfolding P(x) in x.f) == old(unfolding P(x) in x.f)
21
- //:: UnexpectedOutput(assert.failed:assertion.false, /carbon/issue/259/)
22
20
assert (unfolding P(y) in y.f) == old(unfolding P(y) in y.f)
23
21
}
Original file line number Diff line number Diff line change
1
+ // Any copyright is dedicated to the Public Domain.
2
+ // http://creativecommons.org/publicdomain/zero/1.0/
3
+
4
+ field balance: Int
5
+ field amount: Int
6
+
7
+ predicate is_balance(addr: Ref)
8
+ {
9
+ acc(addr.balance)
10
+ }
11
+
12
+ method deposit(coin1: Ref)
13
+ requires acc(coin1.amount)
14
+ ensures acc(coin1.amount)
15
+
16
+ method failing_assertion(x: Ref, coin: Ref)
17
+ requires is_balance(x)
18
+ && acc(coin.amount)
19
+ {
20
+ // inserting this allows Carbon to verify the assertion
21
+ // var b : Int
22
+ // b := unfolding is_balance(x) in x.balance
23
+
24
+ // this should be completely unrelated, however without this line the assertion succeeds
25
+ deposit(coin)
26
+
27
+ // fails in carbon but succeeds in silicon
28
+ assert (unfolding is_balance(x) in x.balance) == old(unfolding is_balance(x) in x.balance)
29
+ }
You can’t perform that action at this time.
0 commit comments