blob: fca79b2e413c64e277411f22a625c86552ac56d5 (
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
|
// RUN: %dafny /compile:0 /print:"%t.print" /dprint:"%t.dprint" "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
trait J
{
function method F(x: int): int
requires x < 100;
ensures F(x) < 100;
method M(x: int) returns (y: int)
requires 0 <= x;
ensures x < y;
}
class C extends J
{
function method F(x: int): int
requires x < 100;
ensures F(x) < 100;
{
x
}
method M(x: int) returns (y: int)
requires -2000 <= x; // a more permissive precondition than in the interface
ensures 2*x < y; // a more detailed postcondition than in the interface
{
y := (2 * x) + 1;
}
}
|