checker: fix tests (adjust byte to u8 in .out files too)
parent
7e2e510e5f
commit
cb6d94bb47
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/array_append_array_type_mismatch_err.vv:3:8: error: cannot append `[]int` to `[]byte`
|
||||
vlib/v/checker/tests/array_append_array_type_mismatch_err.vv:3:8: error: cannot append `[]int` to `[]u8`
|
||||
1 | fn main() {
|
||||
2 | mut bc := []byte{}
|
||||
2 | mut bc := []u8{}
|
||||
3 | bc << [0xCA, 0xFE, 0xBA, 0xBE]
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
4 | println(bc)
|
||||
|
|
|
@ -26,9 +26,9 @@ vlib/v/checker/tests/cast_string_err.vv:26:8: error: cannot cast map to string.
|
|||
| ~~~~~~~~~~
|
||||
27 | println(sm)
|
||||
28 | //
|
||||
vlib/v/checker/tests/cast_string_err.vv:30:8: error: cannot cast []byte to string, use `arr.bytestr()` or `arr.str()` instead.
|
||||
vlib/v/checker/tests/cast_string_err.vv:30:8: error: cannot cast []u8 to string, use `arr.bytestr()` or `arr.str()` instead.
|
||||
28 | //
|
||||
29 | arr := []byte{}
|
||||
29 | arr := []u8{}
|
||||
30 | sa := string(arr)
|
||||
| ~~~~~~~~~~~
|
||||
31 | println(sa)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/cast_string_with_byte_err.vv:2:12: error: cannot cast type `byte` to string, use `by.str()` instead.
|
||||
vlib/v/checker/tests/cast_string_with_byte_err.vv:2:12: error: cannot cast type `u8` to string, use `by.str()` instead.
|
||||
1 | for by in 'abc' {
|
||||
2 | println(string(by))
|
||||
| ~~~~~~~~~~
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
vlib/v/checker/tests/cast_to_byte_err.vv:10:7: error: cannot cast type `string` to `byte`
|
||||
vlib/v/checker/tests/cast_to_byte_err.vv:10:7: error: cannot cast type `string` to `u8`
|
||||
8 | fn main() {
|
||||
9 | // should be errors:
|
||||
10 | _ := byte('hello')
|
||||
| ~~~~~~~~~~~~~
|
||||
11 | _ := byte(SAlias('hello'))
|
||||
10 | _ := u8('hello')
|
||||
| ~~~~~~~~~~~
|
||||
11 | _ := u8(SAlias('hello'))
|
||||
12 |
|
||||
vlib/v/checker/tests/cast_to_byte_err.vv:11:7: error: cannot cast type `SAlias` to `byte`
|
||||
vlib/v/checker/tests/cast_to_byte_err.vv:11:7: error: cannot cast type `SAlias` to `u8`
|
||||
9 | // should be errors:
|
||||
10 | _ := byte('hello')
|
||||
11 | _ := byte(SAlias('hello'))
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
10 | _ := u8('hello')
|
||||
11 | _ := u8(SAlias('hello'))
|
||||
| ~~~~~~~~~~~~~~~~~~~
|
||||
12 |
|
||||
13 | // should be allowed:
|
||||
|
|
|
@ -7,17 +7,17 @@ type FAlias = f32
|
|||
|
||||
fn main() {
|
||||
// should be errors:
|
||||
_ := byte('hello')
|
||||
_ := byte(SAlias('hello'))
|
||||
_ := u8('hello')
|
||||
_ := u8(SAlias('hello'))
|
||||
|
||||
// should be allowed:
|
||||
_ := byte(char(1))
|
||||
_ := byte(int(1))
|
||||
_ := byte(u32(1))
|
||||
_ := byte(f32(1.0))
|
||||
_ := u8(char(1))
|
||||
_ := u8(int(1))
|
||||
_ := u8(u32(1))
|
||||
_ := u8(f32(1.0))
|
||||
|
||||
_ := byte(CAlias(1))
|
||||
_ := byte(IAlias(1))
|
||||
_ := byte(UAlias(1))
|
||||
_ := byte(FAlias(1))
|
||||
_ := u8(CAlias(1))
|
||||
_ := u8(IAlias(1))
|
||||
_ := u8(UAlias(1))
|
||||
_ := u8(FAlias(1))
|
||||
}
|
||||
|
|
|
@ -11,16 +11,16 @@ vlib/v/checker/tests/compare_unsigned_signed.vv:6:5: error: unsigned integer can
|
|||
| ~~
|
||||
7 | println('unexpected')
|
||||
8 | }
|
||||
vlib/v/checker/tests/compare_unsigned_signed.vv:10:18: error: `byte` cannot be compared with negative value
|
||||
vlib/v/checker/tests/compare_unsigned_signed.vv:10:16: error: `u8` cannot be compared with negative value
|
||||
8 | }
|
||||
9 | // unsigned == literal
|
||||
10 | _ = byte(-1) == -1 // false!
|
||||
10 | _ = u8(-1) == -1 // false!
|
||||
| ~~
|
||||
11 | _ = -1 == u16(-1) // false!
|
||||
12 |
|
||||
vlib/v/checker/tests/compare_unsigned_signed.vv:11:6: error: negative value cannot be compared with `u16`
|
||||
9 | // unsigned == literal
|
||||
10 | _ = byte(-1) == -1 // false!
|
||||
10 | _ = u8(-1) == -1 // false!
|
||||
11 | _ = -1 == u16(-1) // false!
|
||||
| ~~
|
||||
12 |
|
||||
|
@ -30,11 +30,11 @@ vlib/v/checker/tests/compare_unsigned_signed.vv:14:14: error: `u16` cannot be co
|
|||
13 | // unsigned == signed
|
||||
14 | _ = u16(-1) == int(-1)
|
||||
| ~~
|
||||
15 | _ = int(-1) != byte(-1)
|
||||
15 | _ = int(-1) != u8(-1)
|
||||
16 | }
|
||||
vlib/v/checker/tests/compare_unsigned_signed.vv:15:14: error: `int` cannot be compared with `byte`
|
||||
vlib/v/checker/tests/compare_unsigned_signed.vv:15:14: error: `int` cannot be compared with `u8`
|
||||
13 | // unsigned == signed
|
||||
14 | _ = u16(-1) == int(-1)
|
||||
15 | _ = int(-1) != byte(-1)
|
||||
15 | _ = int(-1) != u8(-1)
|
||||
| ~~
|
||||
16 | }
|
||||
|
|
|
@ -7,10 +7,10 @@ fn main() {
|
|||
println('unexpected')
|
||||
}
|
||||
// unsigned == literal
|
||||
_ = byte(-1) == -1 // false!
|
||||
_ = u8(-1) == -1 // false!
|
||||
_ = -1 == u16(-1) // false!
|
||||
|
||||
// unsigned == signed
|
||||
_ = u16(-1) == int(-1)
|
||||
_ = int(-1) != byte(-1)
|
||||
_ = int(-1) != u8(-1)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/dump_char.vv:3:6: error: `char` values cannot be dumped directly, use dump(byte(x)) or dump(int(x)) instead
|
||||
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))
|
||||
3 | dump(c)
|
||||
|
|
|
@ -26,7 +26,7 @@ vlib/v/checker/tests/fixed_array_conv.vv:11:13: error: cannot use `[2]int` as `v
|
|||
| ~~~
|
||||
12 | _ = tos(arr, 1)
|
||||
13 | fn (p &int){}(arr)
|
||||
vlib/v/checker/tests/fixed_array_conv.vv:12:10: error: cannot use `[2]int` as `&byte` in argument 1 to `tos`
|
||||
vlib/v/checker/tests/fixed_array_conv.vv:12:10: error: cannot use `[2]int` as `&u8` in argument 1 to `tos`
|
||||
10 | unsafe {
|
||||
11 | _ = memdup(arr, 1)
|
||||
12 | _ = tos(arr, 1)
|
||||
|
|
|
@ -3,12 +3,12 @@ vlib/v/checker/tests/fixed_array_size_err.vv:4:8: error: fixed size cannot be ze
|
|||
3 | fn main() {
|
||||
4 | a := [size]int{}
|
||||
| ~~~~
|
||||
5 | b := [0]byte{}
|
||||
5 | b := [0]u8{}
|
||||
6 | println(a)
|
||||
vlib/v/checker/tests/fixed_array_size_err.vv:5:8: error: fixed size cannot be zero or negative (fixed_size: 0)
|
||||
3 | fn main() {
|
||||
4 | a := [size]int{}
|
||||
5 | b := [0]byte{}
|
||||
5 | b := [0]u8{}
|
||||
| ^
|
||||
6 | println(a)
|
||||
7 | println(b)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/fn_args.vv:9:6: error: cannot use `&int` as `byte` in argument 1 to `uu8`
|
||||
vlib/v/checker/tests/fn_args.vv:9:6: error: cannot use `&int` as `u8` in argument 1 to `uu8`
|
||||
7 | fn basic() {
|
||||
8 | v := 4
|
||||
9 | uu8(&v)
|
||||
|
|
|
@ -1,23 +1,31 @@
|
|||
vlib/v/checker/tests/fn_var.vv:1:10: error: missing return at the end of an anonymous function
|
||||
1 | mut f := fn(i int) byte {}
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
1 | mut f := fn (i int) u8 {}
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
2 | f = 4
|
||||
3 | mut p := &f
|
||||
vlib/v/checker/tests/fn_var.vv:2:5: error: cannot assign to `f`: expected `fn (int) byte`, not `int literal`
|
||||
1 | mut f := fn(i int) byte {}
|
||||
vlib/v/checker/tests/fn_var.vv:2:5: error: cannot assign to `f`: expected `fn (int) u8`, not `int literal`
|
||||
1 | mut f := fn (i int) u8 {}
|
||||
2 | f = 4
|
||||
| ^
|
||||
3 | mut p := &f
|
||||
4 | p = &[f]
|
||||
vlib/v/checker/tests/fn_var.vv:4:5: error: cannot assign to `p`: expected `&fn (int) byte`, not `&[]fn (int) byte`
|
||||
vlib/v/checker/tests/fn_var.vv:4:5: error: cannot assign to `p`: expected `&fn (int) u8`, not `&[]fn (int) u8`
|
||||
2 | f = 4
|
||||
3 | mut p := &f
|
||||
4 | p = &[f]
|
||||
| ^
|
||||
5 | _ = p
|
||||
6 | i := 0
|
||||
vlib/v/checker/tests/fn_var.vv:8:31: error: undefined ident: `i`
|
||||
vlib/v/checker/tests/fn_var.vv:9:10: error: undefined ident: `i`
|
||||
7 | println(i)
|
||||
8 | f = fn (mut a []int) {
|
||||
9 | println(i)
|
||||
| ^
|
||||
10 | }
|
||||
vlib/v/checker/tests/fn_var.vv:8:5: error: cannot assign to `f`: expected `fn (int) u8`, not `fn (mut []int)`
|
||||
6 | i := 0
|
||||
7 | println(i)
|
||||
8 | f = fn(mut a []int) { println(i) }
|
||||
| ^
|
||||
8 | f = fn (mut a []int) {
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
9 | println(i)
|
||||
10 | }
|
||||
|
|
|
@ -4,11 +4,11 @@ vlib/v/checker/tests/if_mut_with_immutable_var_err.vv:5:9: error: `i` is immutab
|
|||
5 | if mut i is int {
|
||||
| ^
|
||||
6 | i = 1
|
||||
7 | } else if mut i is byte {
|
||||
7 | } else if mut i is u8 {
|
||||
vlib/v/checker/tests/if_mut_with_immutable_var_err.vv:7:16: error: `i` is immutable, declare it with `mut` to make it mutable
|
||||
5 | if mut i is int {
|
||||
6 | i = 1
|
||||
7 | } else if mut i is byte {
|
||||
7 | } else if mut i is u8 {
|
||||
| ^
|
||||
8 | i = 2
|
||||
9 | }
|
||||
|
|
|
@ -3,9 +3,9 @@ vlib/v/checker/tests/immutable_builtin_modify.vv:2:3: error: `string` can not be
|
|||
2 | s.len = 123
|
||||
| ~~~
|
||||
3 | //
|
||||
4 | b := []byte{}
|
||||
4 | b := []u8{}
|
||||
vlib/v/checker/tests/immutable_builtin_modify.vv:5:3: error: `array` can not be modified
|
||||
3 | //
|
||||
4 | b := []byte{}
|
||||
4 | b := []u8{}
|
||||
5 | b.len = 34
|
||||
| ~~~
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/is_type_invalid.vv:14:12: error: `IoS` has no variant `byte`
|
||||
vlib/v/checker/tests/is_type_invalid.vv:14:12: error: `IoS` has no variant `u8`
|
||||
12 |
|
||||
13 | fn main() {
|
||||
14 | if IoS(1) is byte {
|
||||
14 | if IoS(1) is u8 {
|
||||
| ~~
|
||||
15 | println('not cool')
|
||||
16 | }
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
vlib/v/checker/tests/match_invalid_type.vv:5:3: error: `IoS` has no variant `byte`.
|
||||
vlib/v/checker/tests/match_invalid_type.vv:5:3: error: `IoS` has no variant `u8`.
|
||||
2 possibilities: `int`, `string`.
|
||||
3 | fn sum() {
|
||||
4 | match IoS(1) {
|
||||
5 | byte {
|
||||
| ~~~~
|
||||
5 | u8 {
|
||||
| ~~
|
||||
6 | println('not cool')
|
||||
7 | }
|
||||
vlib/v/checker/tests/match_invalid_type.vv:4:2: error: match must be exhaustive (add match branches for: `int`, `string` or `else {}` at the end)
|
||||
|
@ -11,7 +11,7 @@ vlib/v/checker/tests/match_invalid_type.vv:4:2: error: match must be exhaustive
|
|||
3 | fn sum() {
|
||||
4 | match IoS(1) {
|
||||
| ~~~~~~~~~~~~~~
|
||||
5 | byte {
|
||||
5 | u8 {
|
||||
6 | println('not cool')
|
||||
vlib/v/checker/tests/match_invalid_type.vv:24:3: error: `Cat` doesn't implement method `speak` of interface `Animal`
|
||||
22 | a := Animal(Dog{})
|
||||
|
|
|
@ -2,7 +2,7 @@ type IoS = int | string
|
|||
|
||||
fn sum() {
|
||||
match IoS(1) {
|
||||
byte {
|
||||
u8 {
|
||||
println('not cool')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,4 @@ vlib/v/checker/tests/match_mut_with_immutable_var_err.vv:5:12: error: `i` is imm
|
|||
5 | match mut i {
|
||||
| ^
|
||||
6 | int { i = 1 }
|
||||
7 | byte { i = 2 }
|
||||
7 | u8 { i = 2 }
|
||||
|
|
|
@ -4,7 +4,7 @@ fn main() {
|
|||
i := Int(0)
|
||||
match mut i {
|
||||
int { i = 1 }
|
||||
byte { i = 2 }
|
||||
u8 { i = 2 }
|
||||
}
|
||||
println(i)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/optional_or_block_none_err.vv:18:3: error: wrong return type `none` in the `or {}` block, expected `Animal`
|
||||
16 | fn main() {
|
||||
17 | mut dog := new_animal(9) or {
|
||||
18 | none
|
||||
vlib/v/checker/tests/optional_or_block_none_err.vv:19:32: error: wrong return type `none` in the `or {}` block, expected `Animal`
|
||||
17 |
|
||||
18 | fn main() {
|
||||
19 | mut dog := new_animal(9) or { none }
|
||||
| ~~~~
|
||||
19 | }
|
||||
20 |
|
||||
21 | println(dog)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
vlib/v/checker/tests/ptr_slice.vv:9:17: error: type `&Foo` does not support slicing
|
||||
vlib/v/checker/tests/ptr_slice.vv:9:14: error: type `&Foo` does not support slicing
|
||||
7 |
|
||||
8 | fn main() {
|
||||
9 | fs := jeje()[1..]
|
||||
| ~~~~~
|
||||
10 | println(fs)
|
||||
11 | vs := byteptr(0)[..3]
|
||||
vlib/v/checker/tests/ptr_slice.vv:11:21: error: type `byteptr` does not support slicing
|
||||
vlib/v/checker/tests/ptr_slice.vv:11:18: error: type `byteptr` does not support slicing
|
||||
9 | fs := jeje()[1..]
|
||||
10 | println(fs)
|
||||
11 | vs := byteptr(0)[..3]
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
vlib/v/checker/tests/struct_type_cast_err.vv:5:10: error: cannot cast struct `Foo` to `string`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:5:7: error: cannot cast struct `Foo` to `string`
|
||||
3 | fn main() {
|
||||
4 | foo := Foo{}
|
||||
5 | _ := string(foo)
|
||||
| ~~~~~~~~~~~
|
||||
6 | _ := int(foo)
|
||||
7 | _ := u64(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:6:10: error: cannot cast struct `Foo` to `int`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:6:7: error: cannot cast struct `Foo` to `int`
|
||||
4 | foo := Foo{}
|
||||
5 | _ := string(foo)
|
||||
6 | _ := int(foo)
|
||||
| ~~~~~~~~
|
||||
7 | _ := u64(foo)
|
||||
8 | _ := u32(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:7:10: error: cannot cast struct `Foo` to `u64`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:7:7: error: cannot cast struct `Foo` to `u64`
|
||||
5 | _ := string(foo)
|
||||
6 | _ := int(foo)
|
||||
7 | _ := u64(foo)
|
||||
| ~~~~~~~~
|
||||
8 | _ := u32(foo)
|
||||
9 | _ := rune(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:8:10: error: cannot cast struct `Foo` to `u32`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:8:7: error: cannot cast struct `Foo` to `u32`
|
||||
6 | _ := int(foo)
|
||||
7 | _ := u64(foo)
|
||||
8 | _ := u32(foo)
|
||||
| ~~~~~~~~
|
||||
9 | _ := rune(foo)
|
||||
10 | _ := byte(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:9:10: error: cannot cast struct `Foo` to `rune`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:9:7: error: cannot cast struct `Foo` to `rune`
|
||||
7 | _ := u64(foo)
|
||||
8 | _ := u32(foo)
|
||||
9 | _ := rune(foo)
|
||||
| ~~~~~~~~~
|
||||
10 | _ := byte(foo)
|
||||
11 | _ := i8(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:10:10: error: cannot cast struct `Foo` to `byte`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:10:7: error: cannot cast `Foo` to `byte` (alias to `u8`)
|
||||
8 | _ := u32(foo)
|
||||
9 | _ := rune(foo)
|
||||
10 | _ := byte(foo)
|
||||
| ~~~~~~~~~
|
||||
11 | _ := i8(foo)
|
||||
12 | _ := i64(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:11:10: error: cannot cast struct `Foo` to `i8`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:11:7: error: cannot cast struct `Foo` to `i8`
|
||||
9 | _ := rune(foo)
|
||||
10 | _ := byte(foo)
|
||||
11 | _ := i8(foo)
|
||||
| ~~~~~~~
|
||||
12 | _ := i64(foo)
|
||||
13 | _ := int(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:12:10: error: cannot cast struct `Foo` to `i64`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:12:7: error: cannot cast struct `Foo` to `i64`
|
||||
10 | _ := byte(foo)
|
||||
11 | _ := i8(foo)
|
||||
12 | _ := i64(foo)
|
||||
| ~~~~~~~~
|
||||
13 | _ := int(foo)
|
||||
14 | _ = &I1(foo)
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:13:10: error: cannot cast struct `Foo` to `int`
|
||||
vlib/v/checker/tests/struct_type_cast_err.vv:13:7: error: cannot cast struct `Foo` to `int`
|
||||
11 | _ := i8(foo)
|
||||
12 | _ := i64(foo)
|
||||
13 | _ := int(foo)
|
||||
|
|
Loading…
Reference in New Issue