67cc89f38d
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.
22 lines
369 B
Rust
22 lines
369 B
Rust
// Issue #53
|
|
|
|
fn main() {
|
|
alt check "test" { "not-test" { fail; } "test" { } _ { fail; } }
|
|
|
|
enum t { tag1(str), tag2, }
|
|
|
|
|
|
alt tag1("test") {
|
|
tag2 { fail; }
|
|
tag1("not-test") { fail; }
|
|
tag1("test") { }
|
|
_ { fail; }
|
|
}
|
|
|
|
let x = alt check "a" { "a" { 1 } "b" { 2 } };
|
|
assert (x == 1);
|
|
|
|
alt check "a" { "a" { } "b" { } }
|
|
|
|
}
|