-
-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reintroduce exhaustiveness checking for
use
(#3880)
- Loading branch information
1 parent
402474b
commit 9eee754
Showing
4 changed files
with
52 additions
and
5 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
29 changes: 29 additions & 0 deletions
29
...pe_/tests/snapshots/gleam_core__type___tests__errors__inexhaustive_use_reports_error.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,29 @@ | ||
--- | ||
source: compiler-core/src/type_/tests/errors.rs | ||
expression: "\nuse [1, 2, 3] <- todo\ntodo\n" | ||
--- | ||
----- SOURCE CODE | ||
|
||
use [1, 2, 3] <- todo | ||
todo | ||
|
||
|
||
----- ERROR | ||
error: Inexhaustive pattern | ||
┌─ /src/one/two.gleam:2:5 | ||
│ | ||
2 │ use [1, 2, 3] <- todo | ||
│ ^^^^^^^^^ | ||
|
||
This assignment uses a pattern that does not match all possible values. If | ||
one of the other values is used then the assignment will crash. | ||
|
||
The missing patterns are: | ||
|
||
[] | ||
[_, _, _, _, ..] | ||
[_, _, _] | ||
[_, _] | ||
[_] | ||
|
||
Hint: Use a more general pattern or use `let assert` instead. |