diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-02-15 09:40:42 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-02-15 15:47:42 +0100 |
| commit | 67cc89f38d2e75cb0dcd6303fbe4bb4f659277a7 (patch) | |
| tree | 99caacd6c05c72beb28e73a9aa759b5db1d88114 /src/test/pretty | |
| parent | 4b63826050dfc579b9ac65a6b72ad0ca6f6b51fc (diff) | |
| download | rust-67cc89f38d2e75cb0dcd6303fbe4bb4f659277a7.tar.gz rust-67cc89f38d2e75cb0dcd6303fbe4bb4f659277a7.zip | |
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.
Diffstat (limited to 'src/test/pretty')
| -rw-r--r-- | src/test/pretty/block-disambig.rs | 10 | ||||
| -rw-r--r-- | src/test/pretty/unary-op-disambig.rs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index d1a7a9b85ac..64752505952 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -8,7 +8,7 @@ fn test2() -> int { let val = @0; { } *val } fn test3() { let regs = @{mutable eax: 0}; - alt true { true { } } + alt check true { true { } } (*regs).eax = 1; } @@ -20,13 +20,13 @@ fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { let regs = @0; - alt true { true { } } + alt check true { true { } } (*regs < 2) as uint } fn test8() -> int { let val = @0; - alt true { + alt check true { true { } } if *val < 1 { @@ -36,11 +36,11 @@ fn test8() -> int { } } -fn test9() { let regs = @mutable 0; alt true { true { } } *regs += 1; } +fn test9() { let regs = @mutable 0; alt check true { true { } } *regs += 1; } fn test10() -> int { let regs = @mutable [0]; - alt true { true { } } + alt check true { true { } } (*regs)[0] } diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index 88406813b42..e9fd2c2dc2c 100644 --- a/src/test/pretty/unary-op-disambig.rs +++ b/src/test/pretty/unary-op-disambig.rs @@ -10,8 +10,8 @@ fn if_semi() -> int { if true { f() } else { f() }; -1 } fn if_nosemi() -> int { (if true { 0 } else { 0 }) - 1 } -fn alt_semi() -> int { alt true { true { f() } }; -1 } +fn alt_semi() -> int { alt check true { true { f() } }; -1 } -fn alt_no_semi() -> int { (alt true { true { 0 } }) - 1 } +fn alt_no_semi() -> int { (alt check true { true { 0 } }) - 1 } fn stmt() { { f() }; -1; } |
