summaryrefslogtreecommitdiff
path: root/Test/dafny0/CompilationErrors.dfy
blob: 80e5eeaeed8939294ebcbbe1c6f61677301ad0f8 (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
// RUN: %dafny "%s" > "%t"
// RUN: %diff "%s.expect" "%t"

type MyType  // compile error: opaque type
iterator Iter()  // compile error: body-less iterator
ghost method M()  // compile error: body-less ghost method
method P()  // compile error: body-less method
method Q()
{
  if g == 0 {
    assume true;  // compile error: assume
  }
}
ghost var g: int;

function F(): int  // compile error: body-less ghost function
function method H(): int  // compile error: body-less function method

lemma Lemma() {
  assume false;  // compile error: assume
}
ghost method GMethod() {
  assume false;  // compile error: assume
}

function MyFunction(): int
{
  assume false;  // compile error: assume
  6
}

function MyCalcFunction(): int
{
  calc <= {
    2;
    6;
    { assume true; }  // compile error: assume
    10;
  }
  12
}