2011-06-16 13:56:34 -05:00
|
|
|
// xfail-stage0
|
|
|
|
// error-pattern:Number is odd
|
|
|
|
pred even(uint x) -> bool {
|
2011-06-17 13:10:51 -05:00
|
|
|
if (x < 2u) {
|
2011-06-16 13:56:34 -05:00
|
|
|
ret false;
|
|
|
|
}
|
2011-06-17 13:10:51 -05:00
|
|
|
else if (x == 2u) {
|
2011-06-16 13:56:34 -05:00
|
|
|
ret true;
|
|
|
|
}
|
|
|
|
else {
|
2011-06-17 13:10:51 -05:00
|
|
|
ret even(x - 2u);
|
2011-06-16 13:56:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo(uint x) -> () {
|
|
|
|
if check(even(x)) {
|
|
|
|
log x;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fail "Number is odd";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo(3u);
|
|
|
|
}
|