rust/src/test/run-pass/alt-pattern-lit.rs
Marijn Haverbeke 67cc89f38d Rewrite exhaustiveness checker
Issue #352
Closes #1720

The old checker would happily accept things like 'alt x { @some(a) { a } }'.
It now properly descends into patterns, checks exhaustiveness of booleans,
and complains when number/string patterns aren't exhaustive.
2012-02-15 15:47:42 +01:00

11 lines
204 B
Rust

fn altlit(f: int) -> int {
alt check f {
10 { #debug("case 10"); ret 20; }
11 { #debug("case 11"); ret 22; }
}
}
fn main() { assert (altlit(10) == 20); assert (altlit(11) == 22); }