-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: report error on duplicate let-binding within same scope (#75)
Fixes #71
- Loading branch information
Showing
6 changed files
with
50 additions
and
17 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
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,6 @@ | ||
// RUN: not %eightc %s 2>&1 | %regtest test %s | ||
|
||
fn foo() { | ||
let zoo = 0; | ||
let zoo = 1; | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/hir/duplicate-let-binding-in-same-scope.eight.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,14 @@ | ||
Error: sema::duplicate_let_binding_in_scope | ||
|
||
× binding zoo has already been declared in this scope | ||
╭─[duplicate-let-binding-in-same-scope.eight:4:3] | ||
3 │ fn foo() { | ||
4 │ let zoo = 0; | ||
· ──────┬───── | ||
· ╰── previously declared here | ||
5 │ let zoo = 1; | ||
· ──────┬───── | ||
· ╰── the binding zoo shadows an existing binding with the same name | ||
6 │ } | ||
╰──── | ||
help: give this binding a different name |