-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing check for duplicated binding in the same pattern
- Loading branch information
Showing
6 changed files
with
151 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
pub enum E { | ||
V(i32, u32) | ||
} | ||
|
||
fn foo(f: E) { | ||
let E::V(x, x) = f | ||
|
||
match f { | ||
E::V(x, x) => () | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
crates/uitest/fixtures/ty_check/pat/duplicated_binding.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
source: crates/uitest/tests/ty_check.rs | ||
expression: diags | ||
input_file: fixtures/ty_check/pat/duplicated_binding.fe | ||
--- | ||
error[8-0032]: duplicate binding `x` in pattern | ||
┌─ duplicated_binding.fe:6:17 | ||
│ | ||
6 │ let E::V(x, x) = f | ||
│ - ^ `x` is defined again here | ||
│ │ | ||
│ first definition of `x` in this pattern | ||
|
||
error[8-0032]: duplicate binding `x` in pattern | ||
┌─ duplicated_binding.fe:9:17 | ||
│ | ||
9 │ E::V(x, x) => () | ||
│ - ^ `x` is defined again here | ||
│ │ | ||
│ first definition of `x` in this pattern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters