From f2447a4bd8646a1b7e3d01687160129bc0c99ba3 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 18 May 2022 12:34:22 +0300 Subject: [PATCH] tests: do not use -prod for compiling .vv files in vlib/v/checker/tests/ and vlib/v/parser/tests/ --- vlib/v/checker/tests/.gitignore | 3 +- .../tests/ambiguous_field_method_err.out | 8 +++- .../array_of_generic_struct_init_err.out | 8 +++- .../tests/assign_to_typeless_variable_err.out | 6 +++ .../v/checker/tests/cannot_cast_to_struct.out | 9 +++- vlib/v/checker/tests/compile_error.out | 14 +++---- vlib/v/checker/tests/comptime_for.out | 13 ++++++ vlib/v/checker/tests/deprecations.out | 40 +++++++++--------- .../tests/disallow_pointer_arithmetic_err.out | 26 ++++++------ vlib/v/checker/tests/enum_cast.out | 8 ++-- .../tests/filter_func_return_nonbool_err.out | 6 +++ vlib/v/checker/tests/fixed_array_conv.out | 14 +++---- .../v/checker/tests/generic_interface_err.out | 5 +++ vlib/v/checker/tests/goto_label.out | 42 ++++++++++++------- .../v/checker/tests/interface_generic_err.out | 5 +++ .../tests/map_func_void_return_err.out | 6 +++ .../tests/map_of_generic_struct_init_err.out | 8 +++- vlib/v/checker/tests/mut_arg.out | 14 +++++++ .../tests/redundant_parentheses_warning.out | 2 +- .../require_or_block_sumtype_map.err.out | 2 +- .../struct_cast_to_struct_generic_err.out | 8 +++- .../tests/struct_cast_to_struct_mut_err_a.out | 8 +++- .../tests/struct_cast_to_struct_mut_err_b.out | 8 +++- .../tests/struct_cast_to_struct_pub_err_a.out | 8 +++- .../tests/struct_cast_to_struct_pub_err_b.out | 8 +++- .../checker/tests/struct_unneeded_default.out | 8 ++-- .../tests/undefined_type_on_sumtype.out | 14 +++---- vlib/v/checker/tests/union_unsafe_fields.out | 10 ++++- .../unsafe_c_calls_should_be_checked.out | 6 +-- ...e_pointer_arithmetic_should_be_checked.out | 8 ++-- vlib/v/checker/tests/unsafe_required.out | 6 +-- .../tests/use_deprecated_function_warning.out | 6 +-- vlib/v/checker/tests/var_duplicate_const.out | 11 ++++- vlib/v/checker/tests/vweb_routing_checks.out | 4 +- vlib/v/compiler_errors_test.v | 10 ++--- vlib/v/parser/tests/closure_not_used.out | 2 +- vlib/v/scanner/tests/position_0_err.out | 2 +- 37 files changed, 251 insertions(+), 115 deletions(-) diff --git a/vlib/v/checker/tests/.gitignore b/vlib/v/checker/tests/.gitignore index 868d19e77b..914870a77e 100644 --- a/vlib/v/checker/tests/.gitignore +++ b/vlib/v/checker/tests/.gitignore @@ -1,4 +1,5 @@ *.v *.c +require_or_block_sumtype_map.err !*_test.v -!modules/**/*.v \ No newline at end of file +!modules/**/*.v diff --git a/vlib/v/checker/tests/ambiguous_field_method_err.out b/vlib/v/checker/tests/ambiguous_field_method_err.out index 019eef5761..31a7360d5e 100644 --- a/vlib/v/checker/tests/ambiguous_field_method_err.out +++ b/vlib/v/checker/tests/ambiguous_field_method_err.out @@ -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` 20 | fn main() { 21 | b := Bar{} @@ -10,4 +16,4 @@ vlib/v/checker/tests/ambiguous_field_method_err.vv:23:9: error: ambiguous field 22 | b.test() 23 | n := b.name | ~~~~ - 24 | } \ No newline at end of file + 24 | } diff --git a/vlib/v/checker/tests/array_of_generic_struct_init_err.out b/vlib/v/checker/tests/array_of_generic_struct_init_err.out index b24df44194..83d4c00be4 100644 --- a/vlib/v/checker/tests/array_of_generic_struct_init_err.out +++ b/vlib/v/checker/tests/array_of_generic_struct_init_err.out @@ -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 - 4 | + 4 | 5 | fn main() { 6 | mut arr := []Item{} | ~~~~ diff --git a/vlib/v/checker/tests/assign_to_typeless_variable_err.out b/vlib/v/checker/tests/assign_to_typeless_variable_err.out index 5ce01263e9..37ab5d3005 100644 --- a/vlib/v/checker/tests/assign_to_typeless_variable_err.out +++ b/vlib/v/checker/tests/assign_to_typeless_variable_err.out @@ -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 1 | fn main() { 2 | val := {} diff --git a/vlib/v/checker/tests/cannot_cast_to_struct.out b/vlib/v/checker/tests/cannot_cast_to_struct.out index 9fe4c10bde..8445bb1b1e 100644 --- a/vlib/v/checker/tests/cannot_cast_to_struct.out +++ b/vlib/v/checker/tests/cannot_cast_to_struct.out @@ -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 | 9 | fn main() { 10 | _ := Test(Abc{}) diff --git a/vlib/v/checker/tests/compile_error.out b/vlib/v/checker/tests/compile_error.out index c2e7e82c3f..3fdbc0b877 100644 --- a/vlib/v/checker/tests/compile_error.out +++ b/vlib/v/checker/tests/compile_error.out @@ -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 2 | 3 | $if !serenity { @@ -5,10 +12,3 @@ vlib/v/checker/tests/compile_error.vv:4:5: error: Only Serenity is supported | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 | } 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 | diff --git a/vlib/v/checker/tests/comptime_for.out b/vlib/v/checker/tests/comptime_for.out index 57e339b3a1..78a99ae184 100644 --- a/vlib/v/checker/tests/comptime_for.out +++ b/vlib/v/checker/tests/comptime_for.out @@ -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` 1 | fn unknown() { 2 | $for m in Huh.methods {} diff --git a/vlib/v/checker/tests/deprecations.out b/vlib/v/checker/tests/deprecations.out index 6c1e8f8ae2..cb8a51dc19 100644 --- a/vlib/v/checker/tests/deprecations.out +++ b/vlib/v/checker/tests/deprecations.out @@ -12,6 +12,26 @@ vlib/v/checker/tests/deprecations.vv:67:4: notice: method `Abc.future` will be d | ~~~~~~~~ 68 | a.past() 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 59 | fn main() { 60 | future() @@ -19,20 +39,6 @@ vlib/v/checker/tests/deprecations.vv:61:2: error: function `past` has been depre | ~~~~~~ 62 | simply_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 62 | simply_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() 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 | } diff --git a/vlib/v/checker/tests/disallow_pointer_arithmetic_err.out b/vlib/v/checker/tests/disallow_pointer_arithmetic_err.out index 3e4422f870..2c2a8c0f09 100644 --- a/vlib/v/checker/tests/disallow_pointer_arithmetic_err.out +++ b/vlib/v/checker/tests/disallow_pointer_arithmetic_err.out @@ -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` 2 | x := 5 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 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 | } diff --git a/vlib/v/checker/tests/enum_cast.out b/vlib/v/checker/tests/enum_cast.out index c71c4acf08..a144c0bea8 100644 --- a/vlib/v/checker/tests/enum_cast.out +++ b/vlib/v/checker/tests/enum_cast.out @@ -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)) 8 | println(Color(10)) 9 | println(Color(12)) | ~~~~~~~~~ 10 | println(Color(-10)) 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)) 9 | println(Color(12)) 10 | println(Color(-10)) | ~~~~~~~~~~ 11 | 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 | 12 | println(Permissions(0b101)) 13 | println(Permissions(0b1010)) | ~~~~~~~~~~~~~~~~~~~ 14 | println(Permissions(-1)) 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)) 13 | println(Permissions(0b1010)) 14 | println(Permissions(-1)) diff --git a/vlib/v/checker/tests/filter_func_return_nonbool_err.out b/vlib/v/checker/tests/filter_func_return_nonbool_err.out index e62f5db75f..bc1f6c167d 100644 --- a/vlib/v/checker/tests/filter_func_return_nonbool_err.out +++ b/vlib/v/checker/tests/filter_func_return_nonbool_err.out @@ -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 1 | fn main() { 2 | list := [1,2,3].filter(stringsss(it)) diff --git a/vlib/v/checker/tests/fixed_array_conv.out b/vlib/v/checker/tests/fixed_array_conv.out index fa72769920..8bcc7966f4 100644 --- a/vlib/v/checker/tests/fixed_array_conv.out +++ b/vlib/v/checker/tests/fixed_array_conv.out @@ -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` 1 | arr := [2,3]! 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) 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` 9 | 10 | unsafe { diff --git a/vlib/v/checker/tests/generic_interface_err.out b/vlib/v/checker/tests/generic_interface_err.out index c82c5ea6bf..774bc6ed00 100644 --- a/vlib/v/checker/tests/generic_interface_err.out +++ b/vlib/v/checker/tests/generic_interface_err.out @@ -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 7 | } 8 | diff --git a/vlib/v/checker/tests/goto_label.out b/vlib/v/checker/tests/goto_label.out index 9312085af5..985b6889a6 100644 --- a/vlib/v/checker/tests/goto_label.out +++ b/vlib/v/checker/tests/goto_label.out @@ -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` 3 | goto f2 4 | f1: @@ -19,20 +47,6 @@ vlib/v/checker/tests/goto_label.vv:8:8: error: unknown label `f2` | ~~ 9 | goto 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` 12 | } 13 | f2: diff --git a/vlib/v/checker/tests/interface_generic_err.out b/vlib/v/checker/tests/interface_generic_err.out index 59a090909c..bae6c4f407 100644 --- a/vlib/v/checker/tests/interface_generic_err.out +++ b/vlib/v/checker/tests/interface_generic_err.out @@ -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 5 | 6 | // no segfault without generic diff --git a/vlib/v/checker/tests/map_func_void_return_err.out b/vlib/v/checker/tests/map_func_void_return_err.out index 943e7b153e..b5cf13ec7a 100644 --- a/vlib/v/checker/tests/map_func_void_return_err.out +++ b/vlib/v/checker/tests/map_func_void_return_err.out @@ -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 1 | fn main() { 2 | list := [1,2,3].map(voids(it)) diff --git a/vlib/v/checker/tests/map_of_generic_struct_init_err.out b/vlib/v/checker/tests/map_of_generic_struct_init_err.out index f9d68ef1c3..bbcafb9f46 100644 --- a/vlib/v/checker/tests/map_of_generic_struct_init_err.out +++ b/vlib/v/checker/tests/map_of_generic_struct_init_err.out @@ -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 - 4 | + 4 | 5 | fn main() { 6 | mut m := map[string]Item{} | ~~~~~~~~~~~~~~~~~ diff --git a/vlib/v/checker/tests/mut_arg.out b/vlib/v/checker/tests/mut_arg.out index 1a546ff0a5..253d73a9e8 100644 --- a/vlib/v/checker/tests/mut_arg.out +++ b/vlib/v/checker/tests/mut_arg.out @@ -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 4 | } 5 | diff --git a/vlib/v/checker/tests/redundant_parentheses_warning.out b/vlib/v/checker/tests/redundant_parentheses_warning.out index a9465b61d1..18fb96b41b 100644 --- a/vlib/v/checker/tests/redundant_parentheses_warning.out +++ b/vlib/v/checker/tests/redundant_parentheses_warning.out @@ -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() { 2 | a := 2 3 | b := ((a + 2)) diff --git a/vlib/v/checker/tests/require_or_block_sumtype_map.err.out b/vlib/v/checker/tests/require_or_block_sumtype_map.err.out index 2564654d08..d1316956ac 100644 --- a/vlib/v/checker/tests/require_or_block_sumtype_map.err.out +++ b/vlib/v/checker/tests/require_or_block_sumtype_map.err.out @@ -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) 7 | } 8 | _ := x['nonexisting'] diff --git a/vlib/v/checker/tests/struct_cast_to_struct_generic_err.out b/vlib/v/checker/tests/struct_cast_to_struct_generic_err.out index 62cb81ab11..b6ee544b4d 100644 --- a/vlib/v/checker/tests/struct_cast_to_struct_generic_err.out +++ b/vlib/v/checker/tests/struct_cast_to_struct_generic_err.out @@ -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{} + 11 | _ := Xyz(abc) + | ~~~~~~~~ + 12 | } +vlib/v/checker/tests/struct_cast_to_struct_generic_err.vv:11:7: error: cannot convert struct `Abc` to struct `Xyz` 9 | fn main() { 10 | abc := Abc{} 11 | _ := Xyz(abc) diff --git a/vlib/v/checker/tests/struct_cast_to_struct_mut_err_a.out b/vlib/v/checker/tests/struct_cast_to_struct_mut_err_a.out index baafe70087..8670b96ae7 100644 --- a/vlib/v/checker/tests/struct_cast_to_struct_mut_err_a.out +++ b/vlib/v/checker/tests/struct_cast_to_struct_mut_err_a.out @@ -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() { 11 | abc := Abc{} 12 | _ := Xyz(abc) diff --git a/vlib/v/checker/tests/struct_cast_to_struct_mut_err_b.out b/vlib/v/checker/tests/struct_cast_to_struct_mut_err_b.out index aa6f2324dc..7a7576df07 100644 --- a/vlib/v/checker/tests/struct_cast_to_struct_mut_err_b.out +++ b/vlib/v/checker/tests/struct_cast_to_struct_mut_err_b.out @@ -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() { 11 | abc := Abc{} 12 | _ := Xyz(abc) diff --git a/vlib/v/checker/tests/struct_cast_to_struct_pub_err_a.out b/vlib/v/checker/tests/struct_cast_to_struct_pub_err_a.out index 0a2778b2e8..cb1c6d9a05 100644 --- a/vlib/v/checker/tests/struct_cast_to_struct_pub_err_a.out +++ b/vlib/v/checker/tests/struct_cast_to_struct_pub_err_a.out @@ -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() { 11 | abc := Abc{} 12 | _ := Xyz(abc) diff --git a/vlib/v/checker/tests/struct_cast_to_struct_pub_err_b.out b/vlib/v/checker/tests/struct_cast_to_struct_pub_err_b.out index bbc7e3314b..d8f45ff54c 100644 --- a/vlib/v/checker/tests/struct_cast_to_struct_pub_err_b.out +++ b/vlib/v/checker/tests/struct_cast_to_struct_pub_err_b.out @@ -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() { 11 | abc := Abc{} 12 | _ := Xyz(abc) diff --git a/vlib/v/checker/tests/struct_unneeded_default.out b/vlib/v/checker/tests/struct_unneeded_default.out index 029f9fe2c3..1df8082046 100644 --- a/vlib/v/checker/tests/struct_unneeded_default.out +++ b/vlib/v/checker/tests/struct_unneeded_default.out @@ -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 { 2 | n int = 0 | ^ 3 | s string = '' 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 { 2 | n int = 0 3 | s string = '' | ~~ 4 | b bool = false 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 3 | s string = '' 4 | b bool = false | ~~~~~ 5 | } - 6 | \ No newline at end of file + 6 | diff --git a/vlib/v/checker/tests/undefined_type_on_sumtype.out b/vlib/v/checker/tests/undefined_type_on_sumtype.out index e664d3004a..be991a6caf 100644 --- a/vlib/v/checker/tests/undefined_type_on_sumtype.out +++ b/vlib/v/checker/tests/undefined_type_on_sumtype.out @@ -1,13 +1,13 @@ -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 -vlib/v/checker/tests/undefined_type_on_sumtype.vv:30:4: error: unused variable: `rx` +vlib/v/checker/tests/undefined_type_on_sumtype.vv:30:4: warning: unused variable: `rx` 28 | match r { 29 | Some { 30 | rx := r.value | ~~ 31 | } 32 | None {} +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 diff --git a/vlib/v/checker/tests/union_unsafe_fields.out b/vlib/v/checker/tests/union_unsafe_fields.out index be40d1bcc3..6f49cc1d53 100644 --- a/vlib/v/checker/tests/union_unsafe_fields.out +++ b/vlib/v/checker/tests/union_unsafe_fields.out @@ -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} 9 | u.f = 3.3 // ok 10 | _ := u.u | ^ 11 | return &u.f 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 10 | _ := u.u 11 | return &u.f | ^ 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 | } diff --git a/vlib/v/checker/tests/unsafe_c_calls_should_be_checked.out b/vlib/v/checker/tests/unsafe_c_calls_should_be_checked.out index 3d791c40fd..f666453106 100644 --- a/vlib/v/checker/tests/unsafe_c_calls_should_be_checked.out +++ b/vlib/v/checker/tests/unsafe_c_calls_should_be_checked.out @@ -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 - 1 | +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 | 2 | fn test_c() { 3 | mut p := C.malloc(4) | ~~~~~~~~~ 4 | s := 'hope' 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) 4 | s := 'hope' 5 | C.memcpy(p, s.str, 4) diff --git a/vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.out b/vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.out index 9ac0225f81..0280ff6e6f 100644 --- a/vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.out +++ b/vlib/v/checker/tests/unsafe_pointer_arithmetic_should_be_checked.out @@ -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 3 | mut p := &v 4 | p++ | ~~ 5 | p += 2 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 4 | p++ 5 | p += 2 | ~~ 6 | _ := v 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() { 10 | v := 4 11 | mut q := &v - 1 | ~~~~~~ 12 | q = q + 3 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 11 | mut q := &v - 1 12 | q = q + 3 diff --git a/vlib/v/checker/tests/unsafe_required.out b/vlib/v/checker/tests/unsafe_required.out index 463a6a2688..8be73c6206 100644 --- a/vlib/v/checker/tests/unsafe_required.out +++ b/vlib/v/checker/tests/unsafe_required.out @@ -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() { 7 | s := S1{} 8 | s.f() | ~~~ 9 | } 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 15 | c := &b 16 | _ = c[0] | ~~~ 17 | 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 19 | p := &v 20 | _ = p[0] diff --git a/vlib/v/checker/tests/use_deprecated_function_warning.out b/vlib/v/checker/tests/use_deprecated_function_warning.out index 9cffcba64e..b601b4d0ab 100644 --- a/vlib/v/checker/tests/use_deprecated_function_warning.out +++ b/vlib/v/checker/tests/use_deprecated_function_warning.out @@ -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 | 11 | fn main() { 12 | xyz() | ~~~~~ 13 | abc() 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() { 12 | xyz() 13 | abc() | ~~~~~ 14 | } 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() { 22 | s := S1{} 23 | s.m() diff --git a/vlib/v/checker/tests/var_duplicate_const.out b/vlib/v/checker/tests/var_duplicate_const.out index b7b4633828..fa23013548 100644 --- a/vlib/v/checker/tests/var_duplicate_const.out +++ b/vlib/v/checker/tests/var_duplicate_const.out @@ -1,5 +1,12 @@ -vlib/v/checker/tests/var_duplicate_const.vv:4:5: error: duplicate of a const name `size` - 2 | +vlib/v/checker/tests/var_duplicate_const.vv:4:5: warning: duplicate of a const name `size` + 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() { 4 | size := 11 | ~~~~ diff --git a/vlib/v/checker/tests/vweb_routing_checks.out b/vlib/v/checker/tests/vweb_routing_checks.out index 141d7b5a49..179437a5e9 100644 --- a/vlib/v/checker/tests/vweb_routing_checks.out +++ b/vlib/v/checker/tests/vweb_routing_checks.out @@ -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 19 | ['/bar'] 20 | pub fn (mut app App) bar(a string) vweb.Result { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21 | return app.html('works') 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 25 | ['/cow/:low'] 26 | pub fn (mut app App) cow() vweb.Result { diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index 1c58898952..bd2ac58728 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -78,14 +78,13 @@ fn test_all() { module_tests := get_tests_in_dir(module_dir, true) run_tests := get_tests_in_dir(run_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{ vexe: vexe label: 'all tests' } - tasks.add('', parser_dir, '-prod', '.out', parser_tests, false) - tasks.add('', checker_dir, '-prod', '.out', checker_tests, false) - tasks.add('', scanner_dir, '-prod', '.out', scanner_tests, false) + tasks.add('', parser_dir, '', '.out', parser_tests, false) + tasks.add('', checker_dir, '', '.out', checker_tests, false) + tasks.add('', scanner_dir, '', '.out', scanner_tests, false) tasks.add('', checker_dir, '-enable-globals run', '.run.out', ['globals_error.vv'], false) tasks.add('', global_run_dir, '-enable-globals run', '.run.out', global_run_tests, @@ -264,8 +263,7 @@ fn (mut tasks Tasks) run() { bench.ok() assert true if tasks.show_cmd { - eprintln(bstep_message(mut bench, benchmark.b_ok, '$task.cli_cmd $task.path', - task.took)) + eprintln(bstep_message(mut bench, benchmark.b_ok, '$task.cli_cmd', task.took)) } else { if github_job == '' { // local mode: diff --git a/vlib/v/parser/tests/closure_not_used.out b/vlib/v/parser/tests/closure_not_used.out index 2cd7a06629..cdab98785b 100644 --- a/vlib/v/parser/tests/closure_not_used.out +++ b/vlib/v/parser/tests/closure_not_used.out @@ -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() { 2 | a := 1 3 | f := fn [a] () { diff --git a/vlib/v/scanner/tests/position_0_err.out b/vlib/v/scanner/tests/position_0_err.out index c332f4bdf4..2c9f874745 100644 --- a/vlib/v/scanner/tests/position_0_err.out +++ b/vlib/v/scanner/tests/position_0_err.out @@ -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' | ^ 2 | x := 3