tests: do not use -prod for compiling .vv files in vlib/v/checker/tests/ and vlib/v/parser/tests/

Delyan Angelov 2022-05-18 12:34:22 +03:00 committed by Jef Roosens
parent 888c85dedc
commit a1bd9acf82
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
37 changed files with 251 additions and 115 deletions

View File

@ -1,4 +1,5 @@
*.v *.v
*.c *.c
require_or_block_sumtype_map.err
!*_test.v !*_test.v
!modules/**/*.v !modules/**/*.v

View File

@ -1,3 +1,9 @@
vlib/v/checker/tests/ambiguous_field_method_err.vv:23:2: warning: unused variable: `n`
21 | b := Bar{}
22 | b.test()
23 | n := b.name
| ^
24 | }
vlib/v/checker/tests/ambiguous_field_method_err.vv:22:4: error: ambiguous method `test` vlib/v/checker/tests/ambiguous_field_method_err.vv:22:4: error: ambiguous method `test`
20 | fn main() { 20 | fn main() {
21 | b := Bar{} 21 | b := Bar{}
@ -10,4 +16,4 @@ vlib/v/checker/tests/ambiguous_field_method_err.vv:23:9: error: ambiguous field
22 | b.test() 22 | b.test()
23 | n := b.name 23 | n := b.name
| ~~~~ | ~~~~
24 | } 24 | }

View File

@ -1,5 +1,11 @@
vlib/v/checker/tests/array_of_generic_struct_init_err.vv:6:6: warning: unused variable: `arr`
4 |
5 | fn main() {
6 | mut arr := []Item{}
| ~~~
7 | }
vlib/v/checker/tests/array_of_generic_struct_init_err.vv:6:15: error: generic struct must specify type parameter, e.g. Foo<int> vlib/v/checker/tests/array_of_generic_struct_init_err.vv:6:15: error: generic struct must specify type parameter, e.g. Foo<int>
4 | 4 |
5 | fn main() { 5 | fn main() {
6 | mut arr := []Item{} 6 | mut arr := []Item{}
| ~~~~ | ~~~~

View File

@ -1,3 +1,9 @@
vlib/v/checker/tests/assign_to_typeless_variable_err.vv:2:3: warning: unused variable: `val`
1 | fn main() {
2 | val := {}
| ~~~
3 | val = 1
4 | }
vlib/v/checker/tests/assign_to_typeless_variable_err.vv:2:10: error: invalid empty map initialisation syntax, use e.g. map[string]int{} instead vlib/v/checker/tests/assign_to_typeless_variable_err.vv:2:10: error: invalid empty map initialisation syntax, use e.g. map[string]int{} instead
1 | fn main() { 1 | fn main() {
2 | val := {} 2 | val := {}

View File

@ -1,4 +1,11 @@
vlib/v/checker/tests/cannot_cast_to_struct.vv:10:7: error: casting to struct is deprecated, use e.g. `Struct{...expr}` instead vlib/v/checker/tests/cannot_cast_to_struct.vv:10:7: warning: casting to struct is deprecated, use e.g. `Struct{...expr}` instead
8 |
9 | fn main() {
10 | _ := Test(Abc{})
| ~~~~~~~~~~~
11 | sum := Alphabet(Xyz{})
12 | _ = Xyz(sum)
vlib/v/checker/tests/cannot_cast_to_struct.vv:10:7: error: cannot convert struct `Abc` to struct `Test`
8 | 8 |
9 | fn main() { 9 | fn main() {
10 | _ := Test(Abc{}) 10 | _ := Test(Abc{})

View File

@ -1,3 +1,10 @@
vlib/v/checker/tests/compile_error.vv:8:5: warning: On non Vinix this warning should be shown
6 |
7 | $if !vinix {
8 | $compile_warn('On non Vinix this warning should be shown')
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 | }
10 |
vlib/v/checker/tests/compile_error.vv:4:5: error: Only Serenity is supported vlib/v/checker/tests/compile_error.vv:4:5: error: Only Serenity is supported
2 | 2 |
3 | $if !serenity { 3 | $if !serenity {
@ -5,10 +12,3 @@ vlib/v/checker/tests/compile_error.vv:4:5: error: Only Serenity is supported
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 | } 5 | }
6 | 6 |
vlib/v/checker/tests/compile_error.vv:8:5: error: On non Vinix this warning should be shown
6 |
7 | $if !vinix {
8 | $compile_warn('On non Vinix this warning should be shown')
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 | }
10 |

View File

@ -1,3 +1,16 @@
vlib/v/checker/tests/comptime_for.vv:2:7: warning: unused variable: `m`
1 | fn unknown() {
2 | $for m in Huh.methods {}
| ^
3 | $for f in Huh.fields {}
4 | $for f in T.fields {
vlib/v/checker/tests/comptime_for.vv:3:7: warning: unused variable: `f`
1 | fn unknown() {
2 | $for m in Huh.methods {}
3 | $for f in Huh.fields {}
| ^
4 | $for f in T.fields {
5 | $if f.typ is Huh {}
vlib/v/checker/tests/comptime_for.vv:2:12: error: unknown type `Huh` vlib/v/checker/tests/comptime_for.vv:2:12: error: unknown type `Huh`
1 | fn unknown() { 1 | fn unknown() {
2 | $for m in Huh.methods {} 2 | $for m in Huh.methods {}

View File

@ -12,6 +12,26 @@ vlib/v/checker/tests/deprecations.vv:67:4: notice: method `Abc.future` will be d
| ~~~~~~~~ | ~~~~~~~~
68 | a.past() 68 | a.past()
69 | a.simply_deprecated() 69 | a.simply_deprecated()
vlib/v/checker/tests/deprecations.vv:62:2: warning: function `simply_deprecated` has been deprecated; custom message 7
60 | future()
61 | past()
62 | simply_deprecated()
| ~~~~~~~~~~~~~~~~~~~
63 | just_deprecated()
64 | ancient()
vlib/v/checker/tests/deprecations.vv:63:2: warning: function `just_deprecated` has been deprecated
61 | past()
62 | simply_deprecated()
63 | just_deprecated()
| ~~~~~~~~~~~~~~~~~
64 | ancient()
65 | //
vlib/v/checker/tests/deprecations.vv:69:4: warning: method `Abc.simply_deprecated` has been deprecated; custom message 3
67 | a.future()
68 | a.past()
69 | a.simply_deprecated()
| ~~~~~~~~~~~~~~~~~~~
70 | }
vlib/v/checker/tests/deprecations.vv:61:2: error: function `past` has been deprecated since 2021-03-01; custom message 5 vlib/v/checker/tests/deprecations.vv:61:2: error: function `past` has been deprecated since 2021-03-01; custom message 5
59 | fn main() { 59 | fn main() {
60 | future() 60 | future()
@ -19,20 +39,6 @@ vlib/v/checker/tests/deprecations.vv:61:2: error: function `past` has been depre
| ~~~~~~ | ~~~~~~
62 | simply_deprecated() 62 | simply_deprecated()
63 | just_deprecated() 63 | just_deprecated()
vlib/v/checker/tests/deprecations.vv:62:2: error: function `simply_deprecated` has been deprecated; custom message 7
60 | future()
61 | past()
62 | simply_deprecated()
| ~~~~~~~~~~~~~~~~~~~
63 | just_deprecated()
64 | ancient()
vlib/v/checker/tests/deprecations.vv:63:2: error: function `just_deprecated` has been deprecated
61 | past()
62 | simply_deprecated()
63 | just_deprecated()
| ~~~~~~~~~~~~~~~~~
64 | ancient()
65 | //
vlib/v/checker/tests/deprecations.vv:64:2: error: function `ancient` has been deprecated since 1990-03-01; custom message 6 vlib/v/checker/tests/deprecations.vv:64:2: error: function `ancient` has been deprecated since 1990-03-01; custom message 6
62 | simply_deprecated() 62 | simply_deprecated()
63 | just_deprecated() 63 | just_deprecated()
@ -47,9 +53,3 @@ vlib/v/checker/tests/deprecations.vv:68:4: error: method `Abc.past` has been dep
| ~~~~~~ | ~~~~~~
69 | a.simply_deprecated() 69 | a.simply_deprecated()
70 | } 70 | }
vlib/v/checker/tests/deprecations.vv:69:4: error: method `Abc.simply_deprecated` has been deprecated; custom message 3
67 | a.future()
68 | a.past()
69 | a.simply_deprecated()
| ~~~~~~~~~~~~~~~~~~~
70 | }

View File

@ -1,3 +1,16 @@
vlib/v/checker/tests/disallow_pointer_arithmetic_err.vv:7:7: warning: pointer arithmetic is only allowed in `unsafe` blocks
5 | _ := p * p //should be error
6 | _ := p * 2 //should be error
7 | _ := p + 5 //OK but only in unsafe block, r is *int
| ~~~~~
8 | _ := p - p //OK even in safe code, but n should be isize
9 | }
vlib/v/checker/tests/disallow_pointer_arithmetic_err.vv:8:7: warning: pointer arithmetic is only allowed in `unsafe` blocks
6 | _ := p * 2 //should be error
7 | _ := p + 5 //OK but only in unsafe block, r is *int
8 | _ := p - p //OK even in safe code, but n should be isize
| ~~~~~
9 | }
vlib/v/checker/tests/disallow_pointer_arithmetic_err.vv:4:7: error: invalid operator `+` to `&int` and `&int` vlib/v/checker/tests/disallow_pointer_arithmetic_err.vv:4:7: error: invalid operator `+` to `&int` and `&int`
2 | x := 5 2 | x := 5
3 | p := &x 3 | p := &x
@ -19,16 +32,3 @@ vlib/v/checker/tests/disallow_pointer_arithmetic_err.vv:6:7: error: invalid oper
| ~~~~~ | ~~~~~
7 | _ := p + 5 //OK but only in unsafe block, r is *int 7 | _ := p + 5 //OK but only in unsafe block, r is *int
8 | _ := p - p //OK even in safe code, but n should be isize 8 | _ := p - p //OK even in safe code, but n should be isize
vlib/v/checker/tests/disallow_pointer_arithmetic_err.vv:7:7: error: pointer arithmetic is only allowed in `unsafe` blocks
5 | _ := p * p //should be error
6 | _ := p * 2 //should be error
7 | _ := p + 5 //OK but only in unsafe block, r is *int
| ~~~~~
8 | _ := p - p //OK even in safe code, but n should be isize
9 | }
vlib/v/checker/tests/disallow_pointer_arithmetic_err.vv:8:7: error: pointer arithmetic is only allowed in `unsafe` blocks
6 | _ := p * 2 //should be error
7 | _ := p + 5 //OK but only in unsafe block, r is *int
8 | _ := p - p //OK even in safe code, but n should be isize
| ~~~~~
9 | }

View File

@ -1,25 +1,25 @@
vlib/v/checker/tests/enum_cast.vv:9:13: error: 12 does not represent a value of enum Color vlib/v/checker/tests/enum_cast.vv:9:13: warning: 12 does not represent a value of enum Color
7 | println(Color(0)) 7 | println(Color(0))
8 | println(Color(10)) 8 | println(Color(10))
9 | println(Color(12)) 9 | println(Color(12))
| ~~~~~~~~~ | ~~~~~~~~~
10 | println(Color(-10)) 10 | println(Color(-10))
11 | 11 |
vlib/v/checker/tests/enum_cast.vv:10:13: error: -10 does not represent a value of enum Color vlib/v/checker/tests/enum_cast.vv:10:13: warning: -10 does not represent a value of enum Color
8 | println(Color(10)) 8 | println(Color(10))
9 | println(Color(12)) 9 | println(Color(12))
10 | println(Color(-10)) 10 | println(Color(-10))
| ~~~~~~~~~~ | ~~~~~~~~~~
11 | 11 |
12 | println(Permissions(0b101)) 12 | println(Permissions(0b101))
vlib/v/checker/tests/enum_cast.vv:13:13: error: 10 does not represent a value of enum Permissions vlib/v/checker/tests/enum_cast.vv:13:13: warning: 10 does not represent a value of enum Permissions
11 | 11 |
12 | println(Permissions(0b101)) 12 | println(Permissions(0b101))
13 | println(Permissions(0b1010)) 13 | println(Permissions(0b1010))
| ~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~
14 | println(Permissions(-1)) 14 | println(Permissions(-1))
15 | } 15 | }
vlib/v/checker/tests/enum_cast.vv:14:13: error: -1 does not represent a value of enum Permissions vlib/v/checker/tests/enum_cast.vv:14:13: warning: -1 does not represent a value of enum Permissions
12 | println(Permissions(0b101)) 12 | println(Permissions(0b101))
13 | println(Permissions(0b1010)) 13 | println(Permissions(0b1010))
14 | println(Permissions(-1)) 14 | println(Permissions(-1))

View File

@ -1,3 +1,9 @@
vlib/v/checker/tests/filter_func_return_nonbool_err.vv:2:2: warning: unused variable: `list`
1 | fn main() {
2 | list := [1,2,3].filter(stringsss(it))
| ~~~~
3 | }
4 |
vlib/v/checker/tests/filter_func_return_nonbool_err.vv:2:25: error: type mismatch, `stringsss` must return a bool vlib/v/checker/tests/filter_func_return_nonbool_err.vv:2:25: error: type mismatch, `stringsss` must return a bool
1 | fn main() { 1 | fn main() {
2 | list := [1,2,3].filter(stringsss(it)) 2 | list := [1,2,3].filter(stringsss(it))

View File

@ -1,3 +1,10 @@
vlib/v/checker/tests/fixed_array_conv.vv:6:5: warning: cannot cast a fixed array (use e.g. `&arr[0]` instead)
4 | mut ip := &int(0)
5 | ip = arr
6 | _ = &int(arr)
| ~~~~~~~~~
7 | _ = p
8 | _ = ip
vlib/v/checker/tests/fixed_array_conv.vv:3:3: error: mismatched types `voidptr` and `[2]int` vlib/v/checker/tests/fixed_array_conv.vv:3:3: error: mismatched types `voidptr` and `[2]int`
1 | arr := [2,3]! 1 | arr := [2,3]!
2 | mut p := voidptr(0) 2 | mut p := voidptr(0)
@ -12,13 +19,6 @@ vlib/v/checker/tests/fixed_array_conv.vv:5:4: error: mismatched types `&int` and
| ^ | ^
6 | _ = &int(arr) 6 | _ = &int(arr)
7 | _ = p 7 | _ = p
vlib/v/checker/tests/fixed_array_conv.vv:6:5: error: cannot cast a fixed array (use e.g. `&arr[0]` instead)
4 | mut ip := &int(0)
5 | ip = arr
6 | _ = &int(arr)
| ~~~~~~~~~
7 | _ = p
8 | _ = ip
vlib/v/checker/tests/fixed_array_conv.vv:11:13: error: cannot use `[2]int` as `voidptr` in argument 1 to `memdup` vlib/v/checker/tests/fixed_array_conv.vv:11:13: error: cannot use `[2]int` as `voidptr` in argument 1 to `memdup`
9 | 9 |
10 | unsafe { 10 | unsafe {

View File

@ -1,3 +1,8 @@
vlib/v/checker/tests/generic_interface_err.vv:10:1: warning: unused variable: `i`
8 |
9 | s := Struct{7}
10 | i := Interface(s)
| ^
vlib/v/checker/tests/generic_interface_err.vv:9:6: error: generic struct init must specify type parameter, e.g. Foo<int> vlib/v/checker/tests/generic_interface_err.vv:9:6: error: generic struct init must specify type parameter, e.g. Foo<int>
7 | } 7 | }
8 | 8 |

View File

@ -1,3 +1,31 @@
vlib/v/checker/tests/goto_label.vv:7:8: warning: `goto` requires `unsafe` (consider using labelled break/continue)
5 | goto a1
6 | _ = fn(){
7 | goto f1
| ~~
8 | goto f2
9 | goto a1
vlib/v/checker/tests/goto_label.vv:8:8: warning: `goto` requires `unsafe` (consider using labelled break/continue)
6 | _ = fn(){
7 | goto f1
8 | goto f2
| ~~
9 | goto a1
10 | a1:
vlib/v/checker/tests/goto_label.vv:9:8: warning: `goto` requires `unsafe` (consider using labelled break/continue)
7 | goto f1
8 | goto f2
9 | goto a1
| ~~
10 | a1:
11 | goto a1
vlib/v/checker/tests/goto_label.vv:11:8: warning: `goto` requires `unsafe` (consider using labelled break/continue)
9 | goto a1
10 | a1:
11 | goto a1
| ~~
12 | }
13 | f2:
vlib/v/checker/tests/goto_label.vv:5:7: error: unknown label `a1` vlib/v/checker/tests/goto_label.vv:5:7: error: unknown label `a1`
3 | goto f2 3 | goto f2
4 | f1: 4 | f1:
@ -19,20 +47,6 @@ vlib/v/checker/tests/goto_label.vv:8:8: error: unknown label `f2`
| ~~ | ~~
9 | goto a1 9 | goto a1
10 | a1: 10 | a1:
vlib/v/checker/tests/goto_label.vv:9:8: error: `goto` requires `unsafe` (consider using labelled break/continue)
7 | goto f1
8 | goto f2
9 | goto a1
| ~~
10 | a1:
11 | goto a1
vlib/v/checker/tests/goto_label.vv:11:8: error: `goto` requires `unsafe` (consider using labelled break/continue)
9 | goto a1
10 | a1:
11 | goto a1
| ~~
12 | }
13 | f2:
vlib/v/checker/tests/goto_label.vv:14:7: error: unknown label `a1` vlib/v/checker/tests/goto_label.vv:14:7: error: unknown label `a1`
12 | } 12 | }
13 | f2: 13 | f2:

View File

@ -1,3 +1,8 @@
vlib/v/checker/tests/interface_generic_err.vv:8:1: warning: unused variable: `why`
6 | // no segfault without generic
7 | what := What{}
8 | why := Why(what)
| ~~~
vlib/v/checker/tests/interface_generic_err.vv:7:9: error: generic struct init must specify type parameter, e.g. Foo<int> vlib/v/checker/tests/interface_generic_err.vv:7:9: error: generic struct init must specify type parameter, e.g. Foo<int>
5 | 5 |
6 | // no segfault without generic 6 | // no segfault without generic

View File

@ -1,3 +1,9 @@
vlib/v/checker/tests/map_func_void_return_err.vv:2:2: warning: unused variable: `list`
1 | fn main() {
2 | list := [1,2,3].map(voids(it))
| ~~~~
3 | }
4 |
vlib/v/checker/tests/map_func_void_return_err.vv:2:22: error: type mismatch, `voids` does not return anything vlib/v/checker/tests/map_func_void_return_err.vv:2:22: error: type mismatch, `voids` does not return anything
1 | fn main() { 1 | fn main() {
2 | list := [1,2,3].map(voids(it)) 2 | list := [1,2,3].map(voids(it))

View File

@ -1,5 +1,11 @@
vlib/v/checker/tests/map_of_generic_struct_init_err.vv:6:6: warning: unused variable: `m`
4 |
5 | fn main() {
6 | mut m := map[string]Item{}
| ^
7 | }
vlib/v/checker/tests/map_of_generic_struct_init_err.vv:6:11: error: generic struct `Item` must specify type parameter, e.g. Foo<int> vlib/v/checker/tests/map_of_generic_struct_init_err.vv:6:11: error: generic struct `Item` must specify type parameter, e.g. Foo<int>
4 | 4 |
5 | fn main() { 5 | fn main() {
6 | mut m := map[string]Item{} 6 | mut m := map[string]Item{}
| ~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~

View File

@ -1,3 +1,17 @@
vlib/v/checker/tests/mut_arg.vv:6:3: warning: automatic referencing/dereferencing is deprecated and will be removed soon (got: 0 references, expected: 1 references)
4 | }
5 |
6 | f([3,4])
| ~~~~~
7 | mut a := [1,2]
8 | f(a)
vlib/v/checker/tests/mut_arg.vv:8:3: warning: automatic referencing/dereferencing is deprecated and will be removed soon (got: 0 references, expected: 1 references)
6 | f([3,4])
7 | mut a := [1,2]
8 | f(a)
| ^
9 |
10 | g(mut [3,4])
vlib/v/checker/tests/mut_arg.vv:6:3: error: function `f` parameter `par` is `mut`, so use `mut [3, 4]` instead vlib/v/checker/tests/mut_arg.vv:6:3: error: function `f` parameter `par` is `mut`, so use `mut [3, 4]` instead
4 | } 4 | }
5 | 5 |

View File

@ -1,4 +1,4 @@
vlib/v/checker/tests/redundant_parentheses_warning.vv:3:7: error: redundant parentheses are used vlib/v/checker/tests/redundant_parentheses_warning.vv:3:7: warning: redundant parentheses are used
1 | fn main() { 1 | fn main() {
2 | a := 2 2 | a := 2
3 | b := ((a + 2)) 3 | b := ((a + 2))

View File

@ -1,4 +1,4 @@
vlib/v/checker/tests/require_or_block_sumtype_map.err.vv:8:8: error: `or {}` block required when indexing a map with sum type value vlib/v/checker/tests/require_or_block_sumtype_map.err.vv:8:8: warning: `or {}` block required when indexing a map with sum type value
6 | println(y) 6 | println(y)
7 | } 7 | }
8 | _ := x['nonexisting'] 8 | _ := x['nonexisting']

View File

@ -1,4 +1,10 @@
vlib/v/checker/tests/struct_cast_to_struct_generic_err.vv:11:7: error: casting to struct is deprecated, use e.g. `Struct{...expr}` instead vlib/v/checker/tests/struct_cast_to_struct_generic_err.vv:11:7: warning: casting to struct is deprecated, use e.g. `Struct{...expr}` instead
9 | fn main() {
10 | abc := Abc<int>{}
11 | _ := Xyz(abc)
| ~~~~~~~~
12 | }
vlib/v/checker/tests/struct_cast_to_struct_generic_err.vv:11:7: error: cannot convert struct `Abc<int>` to struct `Xyz`
9 | fn main() { 9 | fn main() {
10 | abc := Abc<int>{} 10 | abc := Abc<int>{}
11 | _ := Xyz(abc) 11 | _ := Xyz(abc)

View File

@ -1,4 +1,10 @@
vlib/v/checker/tests/struct_cast_to_struct_mut_err_a.vv:12:7: error: casting to struct is deprecated, use e.g. `Struct{...expr}` instead vlib/v/checker/tests/struct_cast_to_struct_mut_err_a.vv:12:7: warning: casting to struct is deprecated, use e.g. `Struct{...expr}` instead
10 | fn main() {
11 | abc := Abc{}
12 | _ := Xyz(abc)
| ~~~~~~~~
13 | }
vlib/v/checker/tests/struct_cast_to_struct_mut_err_a.vv:12:7: error: cannot convert struct `Abc` to struct `Xyz`
10 | fn main() { 10 | fn main() {
11 | abc := Abc{} 11 | abc := Abc{}
12 | _ := Xyz(abc) 12 | _ := Xyz(abc)

View File

@ -1,4 +1,10 @@
vlib/v/checker/tests/struct_cast_to_struct_mut_err_b.vv:12:7: error: casting to struct is deprecated, use e.g. `Struct{...expr}` instead vlib/v/checker/tests/struct_cast_to_struct_mut_err_b.vv:12:7: warning: casting to struct is deprecated, use e.g. `Struct{...expr}` instead
10 | fn main() {
11 | abc := Abc{}
12 | _ := Xyz(abc)
| ~~~~~~~~
13 | }
vlib/v/checker/tests/struct_cast_to_struct_mut_err_b.vv:12:7: error: cannot convert struct `Abc` to struct `Xyz`
10 | fn main() { 10 | fn main() {
11 | abc := Abc{} 11 | abc := Abc{}
12 | _ := Xyz(abc) 12 | _ := Xyz(abc)

View File

@ -1,4 +1,10 @@
vlib/v/checker/tests/struct_cast_to_struct_pub_err_a.vv:12:7: error: casting to struct is deprecated, use e.g. `Struct{...expr}` instead vlib/v/checker/tests/struct_cast_to_struct_pub_err_a.vv:12:7: warning: casting to struct is deprecated, use e.g. `Struct{...expr}` instead
10 | fn main() {
11 | abc := Abc{}
12 | _ := Xyz(abc)
| ~~~~~~~~
13 | }
vlib/v/checker/tests/struct_cast_to_struct_pub_err_a.vv:12:7: error: cannot convert struct `Abc` to struct `Xyz`
10 | fn main() { 10 | fn main() {
11 | abc := Abc{} 11 | abc := Abc{}
12 | _ := Xyz(abc) 12 | _ := Xyz(abc)

View File

@ -1,4 +1,10 @@
vlib/v/checker/tests/struct_cast_to_struct_pub_err_b.vv:12:7: error: casting to struct is deprecated, use e.g. `Struct{...expr}` instead vlib/v/checker/tests/struct_cast_to_struct_pub_err_b.vv:12:7: warning: casting to struct is deprecated, use e.g. `Struct{...expr}` instead
10 | fn main() {
11 | abc := Abc{}
12 | _ := Xyz(abc)
| ~~~~~~~~
13 | }
vlib/v/checker/tests/struct_cast_to_struct_pub_err_b.vv:12:7: error: cannot convert struct `Abc` to struct `Xyz`
10 | fn main() { 10 | fn main() {
11 | abc := Abc{} 11 | abc := Abc{}
12 | _ := Xyz(abc) 12 | _ := Xyz(abc)

View File

@ -1,20 +1,20 @@
vlib/v/checker/tests/struct_unneeded_default.vv:2:10: error: unnecessary default value of `0`: struct fields are zeroed by default vlib/v/checker/tests/struct_unneeded_default.vv:2:10: warning: unnecessary default value of `0`: struct fields are zeroed by default
1 | struct Test { 1 | struct Test {
2 | n int = 0 2 | n int = 0
| ^ | ^
3 | s string = '' 3 | s string = ''
4 | b bool = false 4 | b bool = false
vlib/v/checker/tests/struct_unneeded_default.vv:3:13: error: unnecessary default value of '': struct fields are zeroed by default vlib/v/checker/tests/struct_unneeded_default.vv:3:13: warning: unnecessary default value of '': struct fields are zeroed by default
1 | struct Test { 1 | struct Test {
2 | n int = 0 2 | n int = 0
3 | s string = '' 3 | s string = ''
| ~~ | ~~
4 | b bool = false 4 | b bool = false
5 | } 5 | }
vlib/v/checker/tests/struct_unneeded_default.vv:4:11: error: unnecessary default value `false`: struct fields are zeroed by default vlib/v/checker/tests/struct_unneeded_default.vv:4:11: warning: unnecessary default value `false`: struct fields are zeroed by default
2 | n int = 0 2 | n int = 0
3 | s string = '' 3 | s string = ''
4 | b bool = false 4 | b bool = false
| ~~~~~ | ~~~~~
5 | } 5 | }
6 | 6 |

View File

@ -1,13 +1,13 @@
vlib/v/checker/tests/undefined_type_on_sumtype.vv:1:17: error: unknown type `Token`. vlib/v/checker/tests/undefined_type_on_sumtype.vv:30:4: warning: unused variable: `rx`
Did you mean `Ok<[]Token>`?
1 | type ParseRes = Result<[]Token, ParseErr>
| ~~~~~~~~~~~~~~~~~~~~~~~~~
2 |
3 | // Token type is unknown
vlib/v/checker/tests/undefined_type_on_sumtype.vv:30:4: error: unused variable: `rx`
28 | match r { 28 | match r {
29 | Some<ParseRes> { 29 | Some<ParseRes> {
30 | rx := r.value 30 | rx := r.value
| ~~ | ~~
31 | } 31 | }
32 | None<ParseRes> {} 32 | None<ParseRes> {}
vlib/v/checker/tests/undefined_type_on_sumtype.vv:1:17: error: unknown type `Token`.
Did you mean `Ok<[]Token>`?
1 | type ParseRes = Result<[]Token, ParseErr>
| ~~~~~~~~~~~~~~~~~~~~~~~~~
2 |
3 | // Token type is unknown

View File

@ -1,13 +1,19 @@
vlib/v/checker/tests/union_unsafe_fields.vv:10:9: error: reading a union field (or its address) requires `unsafe` vlib/v/checker/tests/union_unsafe_fields.vv:10:9: warning: reading a union field (or its address) requires `unsafe`
8 | mut u := Uf32{u: 3} 8 | mut u := Uf32{u: 3}
9 | u.f = 3.3 // ok 9 | u.f = 3.3 // ok
10 | _ := u.u 10 | _ := u.u
| ^ | ^
11 | return &u.f 11 | return &u.f
12 | } 12 | }
vlib/v/checker/tests/union_unsafe_fields.vv:11:12: error: reading a union field (or its address) requires `unsafe` vlib/v/checker/tests/union_unsafe_fields.vv:11:12: warning: reading a union field (or its address) requires `unsafe`
9 | u.f = 3.3 // ok 9 | u.f = 3.3 // ok
10 | _ := u.u 10 | _ := u.u
11 | return &u.f 11 | return &u.f
| ^ | ^
12 | } 12 | }
vlib/v/checker/tests/union_unsafe_fields.vv:11:9: error: fn `f` expects you to return a non reference type `f32`, but you are returning `&f32` instead
9 | u.f = 3.3 // ok
10 | _ := u.u
11 | return &u.f
| ^
12 | }

View File

@ -1,11 +1,11 @@
vlib/v/checker/tests/unsafe_c_calls_should_be_checked.vv:3:16: error: function `C.malloc` must be called from an `unsafe` block vlib/v/checker/tests/unsafe_c_calls_should_be_checked.vv:3:16: warning: function `C.malloc` must be called from an `unsafe` block
1 | 1 |
2 | fn test_c() { 2 | fn test_c() {
3 | mut p := C.malloc(4) 3 | mut p := C.malloc(4)
| ~~~~~~~~~ | ~~~~~~~~~
4 | s := 'hope' 4 | s := 'hope'
5 | C.memcpy(p, s.str, 4) 5 | C.memcpy(p, s.str, 4)
vlib/v/checker/tests/unsafe_c_calls_should_be_checked.vv:5:7: error: function `C.memcpy` must be called from an `unsafe` block vlib/v/checker/tests/unsafe_c_calls_should_be_checked.vv:5:7: warning: function `C.memcpy` must be called from an `unsafe` block
3 | mut p := C.malloc(4) 3 | mut p := C.malloc(4)
4 | s := 'hope' 4 | s := 'hope'
5 | C.memcpy(p, s.str, 4) 5 | C.memcpy(p, s.str, 4)

View File

@ -1,25 +1,25 @@
vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:4:6: error: pointer arithmetic is only allowed in `unsafe` blocks vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:4:6: warning: pointer arithmetic is only allowed in `unsafe` blocks
2 | mut v := 5 2 | mut v := 5
3 | mut p := &v 3 | mut p := &v
4 | p++ 4 | p++
| ~~ | ~~
5 | p += 2 5 | p += 2
6 | _ := v 6 | _ := v
vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:5:7: error: pointer arithmetic is only allowed in `unsafe` blocks vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:5:7: warning: pointer arithmetic is only allowed in `unsafe` blocks
3 | mut p := &v 3 | mut p := &v
4 | p++ 4 | p++
5 | p += 2 5 | p += 2
| ~~ | ~~
6 | _ := v 6 | _ := v
7 | } 7 | }
vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:11:14: error: pointer arithmetic is only allowed in `unsafe` blocks vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:11:14: warning: pointer arithmetic is only allowed in `unsafe` blocks
9 | fn test_ptr_infix() { 9 | fn test_ptr_infix() {
10 | v := 4 10 | v := 4
11 | mut q := &v - 1 11 | mut q := &v - 1
| ~~~~~~ | ~~~~~~
12 | q = q + 3 12 | q = q + 3
13 | _ := q 13 | _ := q
vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:12:9: error: pointer arithmetic is only allowed in `unsafe` blocks vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.vv:12:9: warning: pointer arithmetic is only allowed in `unsafe` blocks
10 | v := 4 10 | v := 4
11 | mut q := &v - 1 11 | mut q := &v - 1
12 | q = q + 3 12 | q = q + 3

View File

@ -1,18 +1,18 @@
vlib/v/checker/tests/unsafe_required.vv:8:7: error: method `S1.f` must be called from an `unsafe` block vlib/v/checker/tests/unsafe_required.vv:8:7: warning: method `S1.f` must be called from an `unsafe` block
6 | fn test_funcs() { 6 | fn test_funcs() {
7 | s := S1{} 7 | s := S1{}
8 | s.f() 8 | s.f()
| ~~~ | ~~~
9 | } 9 | }
10 | 10 |
vlib/v/checker/tests/unsafe_required.vv:16:7: error: pointer indexing is only allowed in `unsafe` blocks vlib/v/checker/tests/unsafe_required.vv:16:7: warning: pointer indexing is only allowed in `unsafe` blocks
14 | _ = b[0] // OK 14 | _ = b[0] // OK
15 | c := &b 15 | c := &b
16 | _ = c[0] 16 | _ = c[0]
| ~~~ | ~~~
17 | 17 |
18 | v := 4 18 | v := 4
vlib/v/checker/tests/unsafe_required.vv:20:10: error: pointer indexing is only allowed in `unsafe` blocks vlib/v/checker/tests/unsafe_required.vv:20:10: warning: pointer indexing is only allowed in `unsafe` blocks
18 | v := 4 18 | v := 4
19 | p := &v 19 | p := &v
20 | _ = p[0] 20 | _ = p[0]

View File

@ -1,18 +1,18 @@
vlib/v/checker/tests/use_deprecated_function_warning.vv:12:2: error: function `xyz` has been deprecated vlib/v/checker/tests/use_deprecated_function_warning.vv:12:2: warning: function `xyz` has been deprecated
10 | 10 |
11 | fn main() { 11 | fn main() {
12 | xyz() 12 | xyz()
| ~~~~~ | ~~~~~
13 | abc() 13 | abc()
14 | } 14 | }
vlib/v/checker/tests/use_deprecated_function_warning.vv:13:2: error: function `abc` has been deprecated; use foo2 instead vlib/v/checker/tests/use_deprecated_function_warning.vv:13:2: warning: function `abc` has been deprecated; use foo2 instead
11 | fn main() { 11 | fn main() {
12 | xyz() 12 | xyz()
13 | abc() 13 | abc()
| ~~~~~ | ~~~~~
14 | } 14 | }
15 | 15 |
vlib/v/checker/tests/use_deprecated_function_warning.vv:23:4: error: method `S1.m` has been deprecated; use bar instead vlib/v/checker/tests/use_deprecated_function_warning.vv:23:4: warning: method `S1.m` has been deprecated; use bar instead
21 | fn method() { 21 | fn method() {
22 | s := S1{} 22 | s := S1{}
23 | s.m() 23 | s.m()

View File

@ -1,5 +1,12 @@
vlib/v/checker/tests/var_duplicate_const.vv:4:5: error: duplicate of a const name `size` vlib/v/checker/tests/var_duplicate_const.vv:4:5: warning: duplicate of a const name `size`
2 | 2 |
3 | fn main() {
4 | size := 11
| ~~~~
5 | println(main.size)
6 | }
vlib/v/checker/tests/var_duplicate_const.vv:4:5: warning: unused variable: `size`
2 |
3 | fn main() { 3 | fn main() {
4 | size := 11 4 | size := 11
| ~~~~ | ~~~~

View File

@ -1,11 +1,11 @@
vlib/v/checker/tests/vweb_routing_checks.vv:20:1: error: mismatched parameters count between vweb method `App.bar` (1) and route attribute ['/bar'] (0) vlib/v/checker/tests/vweb_routing_checks.vv:20:1: warning: mismatched parameters count between vweb method `App.bar` (1) and route attribute ['/bar'] (0)
18 | // segfault because path taks 0 vars and fcn takes 1 arg 18 | // segfault because path taks 0 vars and fcn takes 1 arg
19 | ['/bar'] 19 | ['/bar']
20 | pub fn (mut app App) bar(a string) vweb.Result { 20 | pub fn (mut app App) bar(a string) vweb.Result {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | return app.html('works') 21 | return app.html('works')
22 | } 22 | }
vlib/v/checker/tests/vweb_routing_checks.vv:26:1: error: mismatched parameters count between vweb method `App.cow` (0) and route attribute ['/cow/:low'] (1) vlib/v/checker/tests/vweb_routing_checks.vv:26:1: warning: mismatched parameters count between vweb method `App.cow` (0) and route attribute ['/cow/:low'] (1)
24 | // no segfault, but it shouldnt compile 24 | // no segfault, but it shouldnt compile
25 | ['/cow/:low'] 25 | ['/cow/:low']
26 | pub fn (mut app App) cow() vweb.Result { 26 | pub fn (mut app App) cow() vweb.Result {

View File

@ -78,14 +78,13 @@ fn test_all() {
module_tests := get_tests_in_dir(module_dir, true) module_tests := get_tests_in_dir(module_dir, true)
run_tests := get_tests_in_dir(run_dir, false) run_tests := get_tests_in_dir(run_dir, false)
skip_unused_dir_tests := get_tests_in_dir(skip_unused_dir, false) skip_unused_dir_tests := get_tests_in_dir(skip_unused_dir, false)
// -prod is used for the parser and checker tests, so that warns are errors
mut tasks := Tasks{ mut tasks := Tasks{
vexe: vexe vexe: vexe
label: 'all tests' label: 'all tests'
} }
tasks.add('', parser_dir, '-prod', '.out', parser_tests, false) tasks.add('', parser_dir, '', '.out', parser_tests, false)
tasks.add('', checker_dir, '-prod', '.out', checker_tests, false) tasks.add('', checker_dir, '', '.out', checker_tests, false)
tasks.add('', scanner_dir, '-prod', '.out', scanner_tests, false) tasks.add('', scanner_dir, '', '.out', scanner_tests, false)
tasks.add('', checker_dir, '-enable-globals run', '.run.out', ['globals_error.vv'], tasks.add('', checker_dir, '-enable-globals run', '.run.out', ['globals_error.vv'],
false) false)
tasks.add('', global_run_dir, '-enable-globals run', '.run.out', global_run_tests, tasks.add('', global_run_dir, '-enable-globals run', '.run.out', global_run_tests,
@ -264,8 +263,7 @@ fn (mut tasks Tasks) run() {
bench.ok() bench.ok()
assert true assert true
if tasks.show_cmd { if tasks.show_cmd {
eprintln(bstep_message(mut bench, benchmark.b_ok, '$task.cli_cmd $task.path', eprintln(bstep_message(mut bench, benchmark.b_ok, '$task.cli_cmd', task.took))
task.took))
} else { } else {
if github_job == '' { if github_job == '' {
// local mode: // local mode:

View File

@ -1,4 +1,4 @@
vlib/v/parser/tests/closure_not_used.vv:3:11: error: unused variable: `a` vlib/v/parser/tests/closure_not_used.vv:3:11: warning: unused variable: `a`
1 | fn my_fn() { 1 | fn my_fn() {
2 | a := 1 2 | a := 1
3 | f := fn [a] () { 3 | f := fn [a] () {

View File

@ -1,4 +1,4 @@
vlib/v/scanner/tests/position_0_err.vv:1:1: error: unused variable: `i` vlib/v/scanner/tests/position_0_err.vv:1:1: warning: unused variable: `i`
1 | i := 'hello' 1 | i := 'hello'
| ^ | ^
2 | x := 3 2 | x := 3