-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checker: check struct aliased field unsign type assigning negative va…
- Loading branch information
Showing
3 changed files
with
20 additions
and
1 deletion.
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
7 changes: 7 additions & 0 deletions
7
vlib/v/checker/tests/struct_aliased_field_unsign_type_check_err.out
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,7 @@ | ||
vlib/v/checker/tests/struct_aliased_field_unsign_type_check_err.vv:9:9: error: cannot assign negative value to unsigned integer type | ||
7 | fn main() { | ||
8 | app := App{ | ||
9 | port: -1 | ||
| ~~ | ||
10 | } | ||
11 | println(app) |
12 changes: 12 additions & 0 deletions
12
vlib/v/checker/tests/struct_aliased_field_unsign_type_check_err.vv
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,12 @@ | ||
type Port = u16 | ||
|
||
struct App { | ||
port Port | ||
} | ||
|
||
fn main() { | ||
app := App{ | ||
port: -1 | ||
} | ||
println(app) | ||
} |