rust/src/test/pretty/unary-op-disambig.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

18 lines
412 B
Rust

// Preserve semicolons that disambiguate unops
fn f() { }
fn block_semi() -> int { { f() }; -1 }
fn block_nosemi() -> int { ({ 0 }) - 1 }
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 check true { true { f() } }; -1 }
fn alt_no_semi() -> int { (alt check true { true { 0 } }) - 1 }
fn stmt() { { f() }; -1; }