]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | An identifier is bound more than once in a pattern. |
2 | ||
3 | Erroneous code example: | |
4 | ||
5 | ```compile_fail,E0416 | |
6 | match (1, 2) { | |
7 | (x, x) => {} // error: identifier `x` is bound more than once in the | |
8 | // same pattern | |
9 | } | |
10 | ``` | |
11 | ||
12 | Please verify you didn't misspell identifiers' name. Example: | |
13 | ||
14 | ``` | |
15 | match (1, 2) { | |
16 | (x, y) => {} // ok! | |
17 | } | |
18 | ``` | |
19 | ||
20 | Or maybe did you mean to unify? Consider using a guard: | |
21 | ||
22 | ``` | |
23 | # let (A, B, C) = (1, 2, 3); | |
24 | match (A, B, C) { | |
25 | (x, x2, see) if x == x2 => { /* A and B are equal, do one thing */ } | |
26 | (y, z, see) => { /* A and B unequal; do another thing */ } | |
27 | } | |
28 | ``` |