aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/_match.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/_match.rs')
-rw-r--r--crates/ra_hir_ty/src/_match.rs75
1 files changed, 75 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/_match.rs b/crates/ra_hir_ty/src/_match.rs
index 596194dcf..c9a6551ab 100644
--- a/crates/ra_hir_ty/src/_match.rs
+++ b/crates/ra_hir_ty/src/_match.rs
@@ -973,6 +973,47 @@ mod tests {
973 } 973 }
974 974
975 #[test] 975 #[test]
976 fn tuple_of_bools_with_ellipsis_at_end_no_diagnostic() {
977 let content = r"
978 fn test_fn() {
979 match (false, true, false) {
980 (false, ..) => {},
981 (true, ..) => {},
982 }
983 }
984 ";
985
986 check_no_diagnostic(content);
987 }
988
989 #[test]
990 fn tuple_of_bools_with_ellipsis_at_beginning_no_diagnostic() {
991 let content = r"
992 fn test_fn() {
993 match (false, true, false) {
994 (.., false) => {},
995 (.., true) => {},
996 }
997 }
998 ";
999
1000 check_no_diagnostic(content);
1001 }
1002
1003 #[test]
1004 fn tuple_of_bools_with_ellipsis_no_diagnostic() {
1005 let content = r"
1006 fn test_fn() {
1007 match (false, true, false) {
1008 (..) => {},
1009 }
1010 }
1011 ";
1012
1013 check_no_diagnostic(content);
1014 }
1015
1016 #[test]
976 fn tuple_of_tuple_and_bools_no_arms() { 1017 fn tuple_of_tuple_and_bools_no_arms() {
977 let content = r" 1018 let content = r"
978 fn test_fn() { 1019 fn test_fn() {
@@ -1553,4 +1594,38 @@ mod false_negatives {
1553 // with `!`. 1594 // with `!`.
1554 check_no_diagnostic(content); 1595 check_no_diagnostic(content);
1555 } 1596 }
1597
1598 #[test]
1599 fn tuple_of_bools_with_ellipsis_at_end_missing_arm() {
1600 let content = r"
1601 fn test_fn() {
1602 match (false, true, false) {
1603 (false, ..) => {},
1604 }
1605 }
1606 ";
1607
1608 // This is a false negative.
1609 // The `..` pattern is currently lowered to a single `Pat::Wild`
1610 // no matter how many fields the `..` pattern is covering. This
1611 // causes the match arm in this test not to type check against
1612 // the match expression, which causes this diagnostic not to
1613 // fire.
1614 check_no_diagnostic(content);
1615 }
1616
1617 #[test]
1618 fn tuple_of_bools_with_ellipsis_at_beginning_missing_arm() {
1619 let content = r"
1620 fn test_fn() {
1621 match (false, true, false) {
1622 (.., false) => {},
1623 }
1624 }
1625 ";
1626
1627 // This is a false negative.
1628 // See comments on `tuple_of_bools_with_ellipsis_at_end_missing_arm`.
1629 check_no_diagnostic(content);
1630 }
1556} 1631}