forked from vlang/v
-
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: disallow nil in non-nil arrays and vice versa (vlang#21786)
- Loading branch information
Showing
5 changed files
with
32 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
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,8 @@ | ||
vlib/v/checker/tests/non_nil_array_with_nil_element_err.vv:1:23: error: invalid array element: expected `string`, not `voidptr` | ||
1 | const spnames = ['f', unsafe { nil }]! | ||
| ~~~~~~ | ||
2 | const spnames1 = [unsafe { nil }, 'f']! | ||
vlib/v/checker/tests/non_nil_array_with_nil_element_err.vv:2:35: error: invalid array element: expected `voidptr`, not `string` | ||
1 | const spnames = ['f', unsafe { nil }]! | ||
2 | const spnames1 = [unsafe { nil }, 'f']! | ||
| ~~~ |
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,2 @@ | ||
const spnames = ['f', unsafe { nil }]! | ||
const spnames1 = [unsafe { nil }, 'f']! |
7 changes: 7 additions & 0 deletions
7
vlib/v/checker/tests/struct_field_assign_internal_types_nil_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
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