1
Fork 0

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.
This commit is contained in:
Marijn Haverbeke 2012-02-15 09:40:42 +01:00
parent 4b63826050
commit 67cc89f38d
32 changed files with 193 additions and 125 deletions

View file

@ -2140,7 +2140,7 @@ mod tests {
fn test_chars_iter() {
let i = 0;
chars_iter("x\u03c0y") {|ch|
alt i {
alt check i {
0 { assert ch == 'x'; }
1 { assert ch == '\u03c0'; }
2 { assert ch == 'y'; }
@ -2156,7 +2156,7 @@ mod tests {
let i = 0;
bytes_iter("xyz") {|bb|
alt i {
alt check i {
0 { assert bb == 'x' as u8; }
1 { assert bb == 'y' as u8; }
2 { assert bb == 'z' as u8; }