blob: b9acc522368539c7a5859c1eab0a2051daddddee (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
method test0(x: int)
{
ghost var {:assumption} a0 := false; // error
ghost var a1, {:assumption} a2 := true, false; // error
ghost var {:assumption} a3: bool;
ghost var {:assumption} a4; // error: type must be bool
a0 := a0 && (0 < x);
a1 := a1 && true;
a3 := true; // error
a3 := a2 && true; // error
a3 := a3 && true;
}
method test1()
{
ghost var {:assumption} a0: bool;
a0 := true; // error
a0 := a0 && true;
a0 := a0 && true; // error
}
method test2()
{
ghost var {:assumption} a0: bool;
a0 := a0 && true;
if (false)
{
var a0 := 1;
a0 := 2;
a0 := 3;
if (false)
{
ghost var {:assumption} a0: bool;
a0 := a0; // error
if (false)
{
ghost var {:assumption} a0: bool;
if (false)
{
ghost var {:assumption} a0 := 1; // 2 errors
if (false)
{
ghost var {:assumption} a0: bool;
a0 := a0 && true;
a0 := a0 && true; // error
}
}
}
}
}
}
method test3() {
var {:assumption} a: bool; // error: assumption variable must be ghost
}
|