summaryrefslogtreecommitdiffstats
path: root/tests/ui/match/issue-18060.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/match/issue-18060.rs')
-rw-r--r--tests/ui/match/issue-18060.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/ui/match/issue-18060.rs b/tests/ui/match/issue-18060.rs
new file mode 100644
index 000000000..b5f3d0f74
--- /dev/null
+++ b/tests/ui/match/issue-18060.rs
@@ -0,0 +1,8 @@
+// run-pass
+// Regression test for #18060: match arms were matching in the wrong order.
+
+fn main() {
+ assert_eq!(2, match (1, 3) { (0, 2..=5) => 1, (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 });
+ assert_eq!(2, match (1, 3) { (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 });
+ assert_eq!(2, match (1, 7) { (0, 2..=5) => 1, (1, 7) => 2, (_, 2..=5) => 3, (_, _) => 4 });
+}