2011-06-17 19:07:23 -07:00
|
|
|
// error-pattern:Unsatisfied precondition constraint
|
2011-07-27 14:19:39 +02:00
|
|
|
pred even(x: uint) -> bool {
|
|
|
|
if x < 2u {
|
|
|
|
ret false;
|
|
|
|
} else if (x == 2u) { ret true; } else { ret even(x - 2u); }
|
2011-06-17 19:07:23 -07:00
|
|
|
}
|
|
|
|
|
2011-07-27 14:48:34 +02:00
|
|
|
fn print_even(x: uint) : even(x) { log x; }
|
2011-06-17 19:07:23 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
fn foo(x: uint) { if check even(x) { fail; } else { print_even(x); } }
|
2011-06-17 19:07:23 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
fn main() { foo(3u); }
|