diff options
Diffstat (limited to 'crates/hir_ty/src/diagnostics/match_check.rs')
-rw-r--r-- | crates/hir_ty/src/diagnostics/match_check.rs | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/crates/hir_ty/src/diagnostics/match_check.rs b/crates/hir_ty/src/diagnostics/match_check.rs index fbe760c39..1c1423fbf 100644 --- a/crates/hir_ty/src/diagnostics/match_check.rs +++ b/crates/hir_ty/src/diagnostics/match_check.rs | |||
@@ -1495,6 +1495,20 @@ fn main(f: Foo) { | |||
1495 | ); | 1495 | ); |
1496 | } | 1496 | } |
1497 | 1497 | ||
1498 | #[test] | ||
1499 | fn internal_or() { | ||
1500 | check_diagnostics( | ||
1501 | r#" | ||
1502 | fn main() { | ||
1503 | enum Either { A(bool), B } | ||
1504 | match Either::B { | ||
1505 | //^^^^^^^^^ Missing match arm | ||
1506 | Either::A(true | false) => (), | ||
1507 | } | ||
1508 | } | ||
1509 | "#, | ||
1510 | ); | ||
1511 | } | ||
1498 | mod false_negatives { | 1512 | mod false_negatives { |
1499 | //! The implementation of match checking here is a work in progress. As we roll this out, we | 1513 | //! The implementation of match checking here is a work in progress. As we roll this out, we |
1500 | //! prefer false negatives to false positives (ideally there would be no false positives). This | 1514 | //! prefer false negatives to false positives (ideally there would be no false positives). This |
@@ -1521,20 +1535,5 @@ fn main() { | |||
1521 | "#, | 1535 | "#, |
1522 | ); | 1536 | ); |
1523 | } | 1537 | } |
1524 | |||
1525 | #[test] | ||
1526 | fn internal_or() { | ||
1527 | // We do not currently handle patterns with internal `or`s. | ||
1528 | check_diagnostics( | ||
1529 | r#" | ||
1530 | fn main() { | ||
1531 | enum Either { A(bool), B } | ||
1532 | match Either::B { | ||
1533 | Either::A(true | false) => (), | ||
1534 | } | ||
1535 | } | ||
1536 | "#, | ||
1537 | ); | ||
1538 | } | ||
1539 | } | 1538 | } |
1540 | } | 1539 | } |