| 1 |
// COMPILED_IMPORTS: imports/testcontracts.d |
| 2 |
|
| 3 |
import imports.testcontracts; |
| 4 |
|
| 5 |
/***************************************************/ |
| 6 |
// https://issues.dlang.org/show_bug.cgi?id=3602 |
| 7 |
|
| 8 |
class Derived3602 : Base3602 |
| 9 |
{ |
| 10 |
override void method(int x, int y) |
| 11 |
in |
| 12 |
{ |
| 13 |
assert(x > 0); |
| 14 |
assert(y > 0); |
| 15 |
} |
| 16 |
do |
| 17 |
{ |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
/***************************************************/ |
| 22 |
// https://issues.dlang.org/show_bug.cgi?id=5230 |
| 23 |
|
| 24 |
class Derived5230 : Base5230 |
| 25 |
{ |
| 26 |
override int method() |
| 27 |
{ |
| 28 |
return 69; |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
/***************************************************/ |
| 33 |
// https://issues.dlang.org/show_bug.cgi?id=17502 |
| 34 |
class Foo17502 |
| 35 |
{ |
| 36 |
auto foo() |
| 37 |
out {} |
| 38 |
do {} |
| 39 |
|
| 40 |
auto bar() |
| 41 |
out { assert (__result > 5); } |
| 42 |
do { return 6; } |
| 43 |
|
| 44 |
auto bar_2() |
| 45 |
out (res) { assert (res > 5); } |
| 46 |
do { return 6; } |
| 47 |
|
| 48 |
int concrete() |
| 49 |
out { assert(__result > 5); } |
| 50 |
do { return 6; } |
| 51 |
|
| 52 |
int concrete_2() |
| 53 |
out(res) { assert (res > 5); } |
| 54 |
do { return 6; } |
| 55 |
|
| 56 |
void void_foo() |
| 57 |
out {} |
| 58 |
do {} |
| 59 |
|
| 60 |
auto void_auto() |
| 61 |
out {} |
| 62 |
do {} |
| 63 |
} |
| 64 |
|
| 65 |
/***************************************************/ |
| 66 |
// Order of declaration: (A), (C : B), (B : A) |
| 67 |
|
| 68 |
class A17502 |
| 69 |
{ |
| 70 |
int method(int p) |
| 71 |
in |
| 72 |
{ |
| 73 |
assert(p > 5); |
| 74 |
} |
| 75 |
out(res) |
| 76 |
{ |
| 77 |
assert(res > 5); |
| 78 |
} |
| 79 |
do |
| 80 |
{ |
| 81 |
return p; |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
class C17502 : B17502 |
| 86 |
{ |
| 87 |
override int method(int p) |
| 88 |
in |
| 89 |
{ |
| 90 |
assert(p > 3); |
| 91 |
} |
| 92 |
do |
| 93 |
{ |
| 94 |
return p * 2; |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
class B17502 : A17502 |
| 99 |
{ |
| 100 |
override int method(int p) |
| 101 |
in |
| 102 |
{ |
| 103 |
assert(p > 2); |
| 104 |
} |
| 105 |
do |
| 106 |
{ |
| 107 |
return p * 3; |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
/***************************************************/ |
| 112 |
// Order of declaration: (X : Y), (Y : Z), (Z) |
| 113 |
|
| 114 |
class X17502 : Y17502 |
| 115 |
{ |
| 116 |
override int method(int p) |
| 117 |
in |
| 118 |
{ |
| 119 |
assert(p > 3); |
| 120 |
} |
| 121 |
do |
| 122 |
{ |
| 123 |
return p * 2; |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
class Y17502 : Z17502 |
| 128 |
{ |
| 129 |
override int method(int p) |
| 130 |
in |
| 131 |
{ |
| 132 |
assert(p > 2); |
| 133 |
} |
| 134 |
do |
| 135 |
{ |
| 136 |
return p * 3; |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
class Z17502 |
| 141 |
{ |
| 142 |
int method(int p) |
| 143 |
in |
| 144 |
{ |
| 145 |
assert(p > 5); |
| 146 |
} |
| 147 |
out(res) |
| 148 |
{ |
| 149 |
assert(res > 5); |
| 150 |
} |
| 151 |
do |
| 152 |
{ |
| 153 |
return p; |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
/***************************************************/ |
| 158 |
// https://issues.dlang.org/show_bug.cgi?id=17893 |
| 159 |
|
| 160 |
final class Foo17893(T) |
| 161 |
{ |
| 162 |
extern(C) void maythrow(); |
| 163 |
|
| 164 |
void bar() |
| 165 |
in |
| 166 |
{ |
| 167 |
maythrow(); |
| 168 |
} |
| 169 |
do |
| 170 |
{ |
| 171 |
} |
| 172 |
} |
| 173 |
|
| 174 |
Foo17893!int foo17893; |
| 175 |
|
| 176 |
/***************************************************/ |
| 177 |
// https://issues.dlang.org/show_bug.cgi?id=15984 |
| 178 |
|
| 179 |
alias Bar15984 = extern (C) void function(void*); |
| 180 |
|
| 181 |
final class C15984 |
| 182 |
{ |
| 183 |
void foo(Bar15984 bar) |
| 184 |
in { assert(bar); } |
| 185 |
do {} |
| 186 |
} |