-
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.
checker: check for unwrapped results in map keys and vals
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
vlib/v/checker/tests/map_key_val_or_not_progagate_err.vv:6:7: error: f() returns `!int`, so it should have either an `or {}` block, or `!` at the end | ||
4 | | ||
5 | a := { | ||
6 | 2: f() // first value | ||
| ~~~ | ||
7 | 3: f() // second value | ||
8 | f(): 1 | ||
vlib/v/checker/tests/map_key_val_or_not_progagate_err.vv:7:7: error: f() returns `!int`, so it should have either an `or {}` block, or `!` at the end | ||
5 | a := { | ||
6 | 2: f() // first value | ||
7 | 3: f() // second value | ||
| ~~~ | ||
8 | f(): 1 | ||
9 | } | ||
vlib/v/checker/tests/map_key_val_or_not_progagate_err.vv:8:2: error: f() returns `!int`, so it should have either an `or {}` block, or `!` at the end | ||
6 | 2: f() // first value | ||
7 | 3: f() // second value | ||
8 | f(): 1 | ||
| ~~~ | ||
9 | } | ||
10 | |
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 @@ | ||
fn f() !int { | ||
return 42 | ||
} | ||
|
||
a := { | ||
2: f() // first value | ||
3: f() // second value | ||
f(): 1 | ||
} | ||
|
||
println(a) |