-
-
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.
- Loading branch information
Adam Oates
committed
Dec 29, 2024
1 parent
4225a34
commit f101781
Showing
15 changed files
with
70 additions
and
50 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
vlib/v/checker/tests/dump_char.vv:3:6: error: `char` values cannot be dumped directly, use dump(u8(x)) or dump(int(x)) instead | ||
1 | c := char(67) | ||
2 | dump(byte(c)) | ||
2 | dump(u8(c)) | ||
3 | dump(c) | ||
| ^ |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
c := char(67) | ||
dump(byte(c)) | ||
dump(u8(c)) | ||
dump(c) |
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 |
---|---|---|
@@ -1,61 +1,55 @@ | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:2:12: warning: byte is deprecated, use u8 instead | ||
1 | @[inline] | ||
2 | fn char(ch byte) fn (string) !(byte, string) { | ||
| ~~~~ | ||
3 | return fn [ch] (input string) !(byte, string) { | ||
4 | return if input[0] == ch { | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:2:1: error: top level declaration cannot shadow builtin type | ||
1 | @[inline] | ||
2 | fn char(ch byte) fn (string) !(byte, string) { | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
3 | return fn [ch] (input string) !(byte, string) { | ||
2 | fn char(ch u8) fn (string) !(u8, string) { | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
3 | return fn [ch] (input string) !(u8, string) { | ||
4 | return if input[0] == ch { | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:18:18: error: unknown function: a_char | ||
16 | | ||
16 | | ||
17 | for i, input in inputs { | ||
18 | got, remain := a_char(input)! | ||
| ~~~~~~~~~~~~~ | ||
19 | | ||
19 | | ||
20 | assert got == 'a'[0] | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:18:31: error: unexpected `!`, the function `a_char` does not return a Result | ||
16 | | ||
16 | | ||
17 | for i, input in inputs { | ||
18 | got, remain := a_char(input)! | ||
| ^ | ||
19 | | ||
19 | | ||
20 | assert got == 'a'[0] | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:18:15: error: assignment mismatch: 2 variables but `a_char()` returns 0 values | ||
16 | | ||
16 | | ||
17 | for i, input in inputs { | ||
18 | got, remain := a_char(input)! | ||
| ~~ | ||
19 | | ||
19 | | ||
20 | assert got == 'a'[0] | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:20:10: error: invalid variable `got` | ||
18 | got, remain := a_char(input)! | ||
19 | | ||
19 | | ||
20 | assert got == 'a'[0] | ||
| ~~~ | ||
21 | assert remain == remains[i] | ||
22 | } | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:20:10: error: assert can be used only with `bool` expressions, but found `void` instead | ||
18 | got, remain := a_char(input)! | ||
19 | | ||
19 | | ||
20 | assert got == 'a'[0] | ||
| ~~~~~~~~~~~~~ | ||
21 | assert remain == remains[i] | ||
22 | } | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:21:10: error: invalid variable `remain` | ||
19 | | ||
19 | | ||
20 | assert got == 'a'[0] | ||
21 | assert remain == remains[i] | ||
| ~~~~~~ | ||
22 | } | ||
23 | } | ||
vlib/v/checker/tests/top_level_fn_builtin_decl_err.vv:21:10: error: assert can be used only with `bool` expressions, but found `void` instead | ||
19 | | ||
19 | | ||
20 | assert got == 'a'[0] | ||
21 | assert remain == remains[i] | ||
| ~~~~~~~~~~~~~~~~~~~~ | ||
22 | } | ||
23 | } | ||
23 | } |
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,25 @@ | ||
vlib/v/checker/tests/use_byte_instead_of_u8_err.vv:1:13: error: type `byte` is an alias, use the original alias type `u8` instead | ||
1 | type Byte = byte | ||
| ~~~~ | ||
2 | | ||
3 | fn foo(_ byte) {} | ||
vlib/v/checker/tests/use_byte_instead_of_u8_err.vv:3:10: error: byte is deprecated, use u8 instead | ||
1 | type Byte = byte | ||
2 | | ||
3 | fn foo(_ byte) {} | ||
| ~~~~ | ||
4 | | ||
5 | fn main() { | ||
vlib/v/checker/tests/use_byte_instead_of_u8_err.vv:6:7: error: byte is deprecated, use u8 instead | ||
4 | | ||
5 | fn main() { | ||
6 | _ := byte(0) | ||
| ~~~~~~~ | ||
7 | _ := fn(_ byte) {} | ||
8 | } | ||
vlib/v/checker/tests/use_byte_instead_of_u8_err.vv:7:12: error: byte is deprecated, use u8 instead | ||
5 | fn main() { | ||
6 | _ := byte(0) | ||
7 | _ := fn(_ byte) {} | ||
| ~~~~ | ||
8 | } |
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 @@ | ||
type Byte = byte | ||
|
||
fn foo(_ byte) {} | ||
|
||
fn main() { | ||
_ := byte(0) | ||
_ := fn(_ byte) {} | ||
} |
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