Skip to content

Commit 0fe9c0a

Browse files
committed
Add tests to exercise the "pattern has N field(s), but" error patterns.
1 parent abfa816 commit 0fe9c0a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
fn main() {
2+
enum color {
3+
rgb(uint, uint, uint),
4+
cmyk(uint, uint, uint, uint),
5+
no_color,
6+
}
7+
8+
fn foo(c: color) {
9+
alt c {
10+
rgb(_, _, _) { }
11+
cmyk(_, _, _, _) { }
12+
no_color(_) { }
13+
//!^ ERROR this pattern has 1 field, but the corresponding variant has no fields
14+
}
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
fn main() {
2+
enum color {
3+
rgb(uint, uint, uint),
4+
cmyk(uint, uint, uint, uint),
5+
no_color,
6+
}
7+
8+
fn foo(c: color) {
9+
alt c {
10+
rgb(_, _) { }
11+
//!^ ERROR this pattern has 2 fields, but the corresponding variant has 3 fields
12+
cmyk(_, _, _, _) { }
13+
no_color { }
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)