errors: show line numbers in default color and add a space
parent
73468b4030
commit
4d04e88679
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/add_op_wrong_left_type_err_a.v:3:5: error: mismatched types `A` and `int`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| A{} + 10
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | A{} + 10
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/add_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `int`
|
||||
1| fn main() {
|
||||
2| [1,2,3] + 10
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | [1,2,3] + 10
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/add_op_wrong_left_type_err_c.v:3:5: error: mismatched types `map_string_int` and `int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| a + 10
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | a + 10
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/add_op_wrong_right_type_err_a.v:3:10: error: mismatched types `int` and `A`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| 10 + A{}
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | 10 + A{}
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/add_op_wrong_right_type_err_b.v:2:10: error: mismatched types `int` and `array_int`
|
||||
1| fn main() {
|
||||
2| 10 + [1,2,3]
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 10 + [1,2,3]
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/add_op_wrong_right_type_err_c.v:3:10: error: mismatched types `int` and `map_string_int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| 10 + a
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | 10 + a
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/alias_type_exists.v:1:1: error: type `Bird` doesn't exist
|
||||
1| type Pigeon Bird
|
||||
~~~~~~~~~~~
|
||||
2|
|
||||
3| fn main() {
|
||||
1 | type Pigeon Bird
|
||||
| ~~~~~~~~~~~
|
||||
2 |
|
||||
3 | fn main() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/ambiguous_function_call_a.v:2:2: error: ambiguous call to: `foo`, may refer to fn `foo` or variable `foo`
|
||||
1| fn foo(foo int) {
|
||||
2| foo(foo + 1)
|
||||
~~~~~~~~~~~~
|
||||
3| }
|
||||
4|
|
||||
1 | fn foo(foo int) {
|
||||
2 | foo(foo + 1)
|
||||
| ~~~~~~~~~~~~
|
||||
3 | }
|
||||
4 |
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/ambiguous_function_call_b.v:3:2: error: ambiguous call to: `foo`, may refer to fn `foo` or variable `foo`
|
||||
1| fn foo() {
|
||||
2| foo := 1
|
||||
3| foo(foo)
|
||||
~~~~~~~~
|
||||
4| }
|
||||
5|
|
||||
1 | fn foo() {
|
||||
2 | foo := 1
|
||||
3 | foo(foo)
|
||||
| ~~~~~~~~
|
||||
4 | }
|
||||
5 |
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_a.v:3:2: error: operator <<= not defined on left operand type `f64`
|
||||
1| fn main() {
|
||||
2| mut foo := 0.5
|
||||
3| foo <<= 1
|
||||
~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 0.5
|
||||
3 | foo <<= 1
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_b.v:3:9: error: operator %= not defined on right operand type `string`
|
||||
1| fn main() {
|
||||
2| mut foo := 10
|
||||
3| foo %= 'hello'
|
||||
~~~~~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 10
|
||||
3 | foo %= 'hello'
|
||||
| ~~~~~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_c.v:3:2: error: operator *= not defined on left operand type `string`
|
||||
1| fn main() {
|
||||
2| mut foo := 'hello'
|
||||
3| foo *= 10
|
||||
~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 'hello'
|
||||
3 | foo *= 10
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_d.v:3:9: error: operator /= not defined on right operand type `bool`
|
||||
1| fn main() {
|
||||
2| mut foo := 1.5
|
||||
3| foo /= true
|
||||
~~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 1.5
|
||||
3 | foo /= true
|
||||
| ~~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_e.v:3:2: error: operator -= not defined on left operand type `string`
|
||||
1| fn main() {
|
||||
2| mut foo := 'hello'
|
||||
3| foo -= `a`
|
||||
~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 'hello'
|
||||
3 | foo -= `a`
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_f.v:3:9: error: operator -= not defined on right operand type `bool`
|
||||
1| fn main() {
|
||||
2| mut foo := 10
|
||||
3| foo -= false
|
||||
~~~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 10
|
||||
3 | foo -= false
|
||||
| ~~~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_g.v:3:2: error: operator += not defined on left operand type `bool`
|
||||
1| fn main() {
|
||||
2| mut foo := true
|
||||
3| foo += false
|
||||
~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := true
|
||||
3 | foo += false
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_h.v:3:9: error: operator += not defined on right operand type `bool`
|
||||
1| fn main() {
|
||||
2| mut foo := 'hello'
|
||||
3| foo += false
|
||||
~~~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 'hello'
|
||||
3 | foo += false
|
||||
| ~~~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/assign_expr_type_err_i.v:3:9: error: cannot assign `string` to variable `foo` of type `f64`
|
||||
1| fn main() {
|
||||
2| mut foo := 1.5
|
||||
3| foo += 'hello'
|
||||
~~~~~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut foo := 1.5
|
||||
3 | foo += 'hello'
|
||||
| ~~~~~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/bit_op_wrong_left_type_err.v:2:2: error: left type of `&` cannot be non-integer type f64
|
||||
1| fn main() {
|
||||
2| 0.5 & 1
|
||||
~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 0.5 & 1
|
||||
| ~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/bit_op_wrong_right_type_err.v:2:6: error: right type of `|` cannot be non-integer type f64
|
||||
1| fn main() {
|
||||
2| 1 | 0.5
|
||||
~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 1 | 0.5
|
||||
| ~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/cannot_assign_array.v:9:11: error: cannot assign `array_fixed_f64_8` to variable `ctx.vb` of type `string`
|
||||
7| mut ctx := Context{}
|
||||
8| x := 2.32
|
||||
9| ctx.vb = [1.1, x, 3.3, 4.4, 5.0, 6.0, 7.0, 8.9]!!
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
10| }
|
||||
7 | mut ctx := Context{}
|
||||
8 | x := 2.32
|
||||
9 | ctx.vb = [1.1, x, 3.3, 4.4, 5.0, 6.0, 7.0, 8.9]!!
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
10 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/const_field_name_duplicate_err.v:3:2: error: field name `aaa` duplicate
|
||||
1| const (
|
||||
2| aaa = 1
|
||||
3| aaa = 2
|
||||
~~~
|
||||
4| )
|
||||
5| fn main() {
|
||||
1 | const (
|
||||
2 | aaa = 1
|
||||
3 | aaa = 2
|
||||
| ~~~
|
||||
4 | )
|
||||
5 | fn main() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/decl_underscore.v:2:2: error: variable names cannot start with `__`
|
||||
1| fn main() {
|
||||
2| __abc := 1
|
||||
~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | __abc := 1
|
||||
| ~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/div_op_wrong_left_type_err_a.v:3:5: error: mismatched types `A` and `int`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| A{} / 10
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | A{} / 10
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/div_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `int`
|
||||
1| fn main() {
|
||||
2| [1,2,3] / 10
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | [1,2,3] / 10
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/div_op_wrong_left_type_err_c.v:3:5: error: mismatched types `map_string_int` and `int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| a / 10
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | a / 10
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/div_op_wrong_right_type_err_a.v:3:10: error: mismatched types `int` and `A`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| 10 / A{}
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | 10 / A{}
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/div_op_wrong_right_type_err_b.v:2:10: error: mismatched types `int` and `array_int`
|
||||
1| fn main() {
|
||||
2| 10 / [1,2,3]
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 10 / [1,2,3]
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/div_op_wrong_right_type_err_c.v:3:10: error: mismatched types `int` and `map_string_int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| 10 / a
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | 10 / a
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/division_by_zero_float_err.v:2:14: error: division by zero
|
||||
1| fn main() {
|
||||
2| println(1.0/0.0)
|
||||
~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | println(1.0/0.0)
|
||||
| ~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/division_by_zero_int_err.v:2:12: error: division by zero
|
||||
1| fn main() {
|
||||
2| println(1/0)
|
||||
^
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | println(1/0)
|
||||
| ^
|
||||
3 | }
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
vlib/v/checker/tests/enum_err.v:4:13: error: default value for enum has to be an integer
|
||||
2|
|
||||
3| enum Color {
|
||||
4| green = 'green'
|
||||
~~~~~~~
|
||||
5| yellow = 1+1
|
||||
6| blue
|
||||
2 |
|
||||
3 | enum Color {
|
||||
4 | green = 'green'
|
||||
| ~~~~~~~
|
||||
5 | yellow = 1+1
|
||||
6 | blue
|
||||
vlib/v/checker/tests/enum_err.v:5:14: error: default value for enum has to be an integer
|
||||
3| enum Color {
|
||||
4| green = 'green'
|
||||
5| yellow = 1+1
|
||||
~~~
|
||||
6| blue
|
||||
7| }
|
||||
3 | enum Color {
|
||||
4 | green = 'green'
|
||||
5 | yellow = 1+1
|
||||
| ~~~
|
||||
6 | blue
|
||||
7 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/enum_field_name_duplicate_err.v:5:2: error: field name `green` duplicate
|
||||
3| yellow
|
||||
4| blue
|
||||
5| green
|
||||
~~~~~
|
||||
6| }
|
||||
7|
|
||||
3 | yellow
|
||||
4 | blue
|
||||
5 | green
|
||||
| ~~~~~
|
||||
6 | }
|
||||
7 |
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
vlib/v/checker/tests/fn_type_exists.v:1:1: error: type `Pants` doesn't exist
|
||||
1| type PantsCreator = fn (a Shirt) Pants
|
||||
~~~~~~~~~~~~~~~~~
|
||||
2|
|
||||
3| type PantsConsumer = fn (p Pants)
|
||||
1 | type PantsCreator = fn (a Shirt) Pants
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
2 |
|
||||
3 | type PantsConsumer = fn (p Pants)
|
||||
vlib/v/checker/tests/fn_type_exists.v:3:1: error: type `Pants` doesn't exist
|
||||
1| type PantsCreator = fn (a Shirt) Pants
|
||||
2|
|
||||
3| type PantsConsumer = fn (p Pants)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
4|
|
||||
5| fn main() {
|
||||
1 | type PantsCreator = fn (a Shirt) Pants
|
||||
2 |
|
||||
3 | type PantsConsumer = fn (p Pants)
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
4 |
|
||||
5 | fn main() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/for-in-index-type.v:2:11: error: for in: cannot index `int`
|
||||
1| fn main() {
|
||||
2| for a in 52 {
|
||||
~~
|
||||
3| println(a)
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | for a in 52 {
|
||||
| ~~
|
||||
3 | println(a)
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/for_in_range_not_match_type.v:2:11: error: range types do not match
|
||||
1| fn main() {
|
||||
2| for i in 10..10.5 {
|
||||
~~
|
||||
3| println(i)
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | for i in 10..10.5 {
|
||||
| ~~
|
||||
3 | println(i)
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/for_in_range_string_type.v:2:11: error: range type can not be string
|
||||
1| fn main() {
|
||||
2| for i in 'a'..'b' {
|
||||
~~~
|
||||
3| println(i)
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | for i in 'a'..'b' {
|
||||
| ~~~
|
||||
3 | println(i)
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/go_expr.v:2:5: error: expression in `go` must be a function call
|
||||
1| fn main() {
|
||||
2| go 1
|
||||
^
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | go 1
|
||||
| ^
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/immutable_array_field_assign.v:9:4: error: field `i` of struct `A` is immutable
|
||||
7| i: [0]
|
||||
8| }
|
||||
9| a.i[0] = 3
|
||||
^
|
||||
10| }
|
||||
7 | i: [0]
|
||||
8 | }
|
||||
9 | a.i[0] = 3
|
||||
| ^
|
||||
10 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/immutable_array_field_shift.v:14:4: error: field `a` of struct `B` is immutable
|
||||
12| a: A{}
|
||||
13| }
|
||||
14| b.a.i << 3
|
||||
^
|
||||
15| }
|
||||
12 | a: A{}
|
||||
13 | }
|
||||
14 | b.a.i << 3
|
||||
| ^
|
||||
15 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/immutable_array_struct_assign.v:8:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
6| fn main() {
|
||||
7| a := A{}
|
||||
8| a.i[0] += 3
|
||||
^
|
||||
9| }
|
||||
6 | fn main() {
|
||||
7 | a := A{}
|
||||
8 | a.i[0] += 3
|
||||
| ^
|
||||
9 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/immutable_array_struct_shift.v:8:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
6| fn main() {
|
||||
7| a := []A{}
|
||||
8| a[0].i << 3
|
||||
^
|
||||
9| }
|
||||
6 | fn main() {
|
||||
7 | a := []A{}
|
||||
8 | a[0].i << 3
|
||||
| ^
|
||||
9 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/immutable_array_var.v:3:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
1| fn main() {
|
||||
2| a := [1, 2]
|
||||
3| a << 3
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := [1, 2]
|
||||
3 | a << 3
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/immutable_field.v:8:4: error: field `i1` of struct `A` is immutable
|
||||
6| fn main() {
|
||||
7| a := A{1}
|
||||
8| a.i1 = 2
|
||||
~~
|
||||
9| }
|
||||
6 | fn main() {
|
||||
7 | a := A{1}
|
||||
8 | a.i1 = 2
|
||||
| ~~
|
||||
9 | }
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
vlib/v/checker/tests/immutable_field_postfix.v:7:4: error: field `i` of struct `A` is immutable
|
||||
5| fn main() {
|
||||
6| mut a := A{}
|
||||
7| a.i++
|
||||
^
|
||||
8| a.i--
|
||||
9| }
|
||||
5 | fn main() {
|
||||
6 | mut a := A{}
|
||||
7 | a.i++
|
||||
| ^
|
||||
8 | a.i--
|
||||
9 | }
|
||||
vlib/v/checker/tests/immutable_field_postfix.v:8:4: error: field `i` of struct `A` is immutable
|
||||
6| mut a := A{}
|
||||
7| a.i++
|
||||
8| a.i--
|
||||
^
|
||||
9| }
|
||||
6 | mut a := A{}
|
||||
7 | a.i++
|
||||
8 | a.i--
|
||||
| ^
|
||||
9 | }
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
vlib/v/checker/tests/immutable_map_postfix.v:3:2: error: `m` is immutable, declare it with `mut` to make it mutable
|
||||
1| fn main() {
|
||||
2| m := map[string]int
|
||||
3| m['test']++
|
||||
^
|
||||
4| m['test']--
|
||||
5| }
|
||||
1 | fn main() {
|
||||
2 | m := map[string]int
|
||||
3 | m['test']++
|
||||
| ^
|
||||
4 | m['test']--
|
||||
5 | }
|
||||
vlib/v/checker/tests/immutable_map_postfix.v:4:2: error: `m` is immutable, declare it with `mut` to make it mutable
|
||||
2| m := map[string]int
|
||||
3| m['test']++
|
||||
4| m['test']--
|
||||
^
|
||||
5| }
|
||||
2 | m := map[string]int
|
||||
3 | m['test']++
|
||||
4 | m['test']--
|
||||
| ^
|
||||
5 | }
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
vlib/v/checker/tests/immutable_struct_postfix.v:8:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
6| fn main() {
|
||||
7| a := A{}
|
||||
8| a.i++
|
||||
^
|
||||
9| a.i--
|
||||
10| }
|
||||
6 | fn main() {
|
||||
7 | a := A{}
|
||||
8 | a.i++
|
||||
| ^
|
||||
9 | a.i--
|
||||
10 | }
|
||||
vlib/v/checker/tests/immutable_struct_postfix.v:9:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
7| a := A{}
|
||||
8| a.i++
|
||||
9| a.i--
|
||||
^
|
||||
10| }
|
||||
7 | a := A{}
|
||||
8 | a.i++
|
||||
9 | a.i--
|
||||
| ^
|
||||
10 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/immutable_var.v:3:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
1| fn main() {
|
||||
2| a := 1
|
||||
3| a = 2
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := 1
|
||||
3 | a = 2
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
vlib/v/checker/tests/immutable_var_postfix.v:3:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
1| fn main() {
|
||||
2| a := 1
|
||||
3| a++
|
||||
^
|
||||
4| a--
|
||||
5| }
|
||||
1 | fn main() {
|
||||
2 | a := 1
|
||||
3 | a++
|
||||
| ^
|
||||
4 | a--
|
||||
5 | }
|
||||
vlib/v/checker/tests/immutable_var_postfix.v:4:2: error: `a` is immutable, declare it with `mut` to make it mutable
|
||||
2| a := 1
|
||||
3| a++
|
||||
4| a--
|
||||
^
|
||||
5| }
|
||||
2 | a := 1
|
||||
3 | a++
|
||||
4 | a--
|
||||
| ^
|
||||
5 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/import_duplicate_err.v:2:8: error: module name `time` duplicate
|
||||
1| import time
|
||||
2| import time
|
||||
~~~~
|
||||
3| fn main() {
|
||||
4| println(time.now().unix_time())
|
||||
1 | import time
|
||||
2 | import time
|
||||
| ~~~~
|
||||
3 | fn main() {
|
||||
4 | println(time.now().unix_time())
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
vlib/v/checker/tests/in_mismatch_type.v:13:7: error: the data type on the left of `in` does not match the array item type
|
||||
11| }
|
||||
12| s := 'abcd'
|
||||
13| if 1 in a_s {
|
||||
~~
|
||||
14| println('ok')
|
||||
15| }
|
||||
11 | }
|
||||
12 | s := 'abcd'
|
||||
13 | if 1 in a_s {
|
||||
| ~~
|
||||
14 | println('ok')
|
||||
15 | }
|
||||
vlib/v/checker/tests/in_mismatch_type.v:16:7: error: the data type on the left of `in` does not match the map key type
|
||||
14| println('ok')
|
||||
15| }
|
||||
16| if 2 in m {
|
||||
~~
|
||||
17| println('yeah')
|
||||
18| }
|
||||
14 | println('ok')
|
||||
15 | }
|
||||
16 | if 2 in m {
|
||||
| ~~
|
||||
17 | println('yeah')
|
||||
18 | }
|
||||
vlib/v/checker/tests/in_mismatch_type.v:19:7: error: the data type on the left of `in` must be a string
|
||||
17| println('yeah')
|
||||
18| }
|
||||
19| if 3 in s {
|
||||
~~
|
||||
20| println('dope')
|
||||
21| }
|
||||
17 | println('yeah')
|
||||
18 | }
|
||||
19 | if 3 in s {
|
||||
| ~~
|
||||
20 | println('dope')
|
||||
21 | }
|
||||
vlib/v/checker/tests/in_mismatch_type.v:22:9: error: the data type on the left of `in` must be a string
|
||||
20| println('dope')
|
||||
21| }
|
||||
22| if `a` in s {
|
||||
~~
|
||||
23| println("oh no :'(")
|
||||
24| }
|
||||
20 | println('dope')
|
||||
21 | }
|
||||
22 | if `a` in s {
|
||||
| ~~
|
||||
23 | println("oh no :'(")
|
||||
24 | }
|
||||
vlib/v/checker/tests/in_mismatch_type.v:25:7: error: `in` can only be used with an array/map/string
|
||||
23| println("oh no :'(")
|
||||
24| }
|
||||
25| if 1 in 12 {
|
||||
~~
|
||||
26| println('right')
|
||||
27| }
|
||||
23 | println("oh no :'(")
|
||||
24 | }
|
||||
25 | if 1 in 12 {
|
||||
| ~~
|
||||
26 | println('right')
|
||||
27 | }
|
||||
vlib/v/checker/tests/in_mismatch_type.v:28:12: error: the data type on the left of `in` does not match the map key type
|
||||
26| println('right')
|
||||
27| }
|
||||
28| if Int(2) in m {
|
||||
~~
|
||||
29| println('yeah')
|
||||
30| }
|
||||
26 | println('right')
|
||||
27 | }
|
||||
28 | if Int(2) in m {
|
||||
| ~~
|
||||
29 | println('yeah')
|
||||
30 | }
|
||||
vlib/v/checker/tests/in_mismatch_type.v:31:15: error: the data type on the left of `in` does not match the array item type
|
||||
29| println('yeah')
|
||||
30| }
|
||||
31| if Str2('3') in a_i {
|
||||
~~
|
||||
32| println('sure')
|
||||
33| }
|
||||
29 | println('yeah')
|
||||
30 | }
|
||||
31 | if Str2('3') in a_i {
|
||||
| ~~
|
||||
32 | println('sure')
|
||||
33 | }
|
||||
vlib/v/checker/tests/in_mismatch_type.v:34:15: error: the data type on the left of `in` does not match the array item type
|
||||
32| println('sure')
|
||||
33| }
|
||||
34| if Str3('2') in a_i {
|
||||
~~
|
||||
35| println('all right')
|
||||
36| }
|
||||
32 | println('sure')
|
||||
33 | }
|
||||
34 | if Str3('2') in a_i {
|
||||
| ~~
|
||||
35 | println('all right')
|
||||
36 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/is_type_not_exist.v:8:10: error: is: type `SomethingThatDontExist` does not exist
|
||||
6|
|
||||
7| fn fn_with_sum_type_param(i Integer) {
|
||||
8| if i is SomethingThatDontExist {
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
9| println('It should fail !')
|
||||
10| }
|
||||
6 |
|
||||
7 | fn fn_with_sum_type_param(i Integer) {
|
||||
8 | if i is SomethingThatDontExist {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
9 | println('It should fail !')
|
||||
10 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/left_shift_err.v:3:7: error: cannot shift type string into array_int
|
||||
1| fn main() {
|
||||
2| mut l := []int{}
|
||||
3| l << 'test'
|
||||
~~~~~~
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | mut l := []int{}
|
||||
3 | l << 'test'
|
||||
| ~~~~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/main_args_err.v:1:1: error: function `main` cannot have arguments
|
||||
1| fn main(a string) {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
2| println(a)
|
||||
3| }
|
||||
1 | fn main(a string) {
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
2 | println(a)
|
||||
3 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/main_called_err.v:2:2: error: the `main` function cannot be called in the program
|
||||
1| fn main() {
|
||||
2| main()
|
||||
~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | main()
|
||||
| ~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/main_return_err.v:1:1: error: function `main` cannot return values
|
||||
1| fn main() f64 {
|
||||
~~~~~~~~~~~~~
|
||||
2| return 1.23
|
||||
3| }
|
||||
1 | fn main() f64 {
|
||||
| ~~~~~~~~~~~~~
|
||||
2 | return 1.23
|
||||
3 | }
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
vlib/v/checker/tests/match_duplicate_branch.v:15:3: error: match case `St1` is handled more than once
|
||||
13| match i {
|
||||
14| St1 { println('St1') }
|
||||
15| St1 { println('St1') }
|
||||
~~~~~
|
||||
16| St2 { println('St2') }
|
||||
17| }
|
||||
13 | match i {
|
||||
14 | St1 { println('St1') }
|
||||
15 | St1 { println('St1') }
|
||||
| ~~~~~
|
||||
16 | St2 { println('St2') }
|
||||
17 | }
|
||||
vlib/v/checker/tests/match_duplicate_branch.v:20:3: error: match case `St1` is handled more than once
|
||||
18| match i {
|
||||
19| St1 { println('St1') }
|
||||
20| St1 { println('St1') }
|
||||
~~~~~
|
||||
21| else { println('else') }
|
||||
22| }
|
||||
18 | match i {
|
||||
19 | St1 { println('St1') }
|
||||
20 | St1 { println('St1') }
|
||||
| ~~~~~
|
||||
21 | else { println('else') }
|
||||
22 | }
|
||||
vlib/v/checker/tests/match_duplicate_branch.v:29:3: error: match case `green` is handled more than once
|
||||
27| .red { println('red') }
|
||||
28| .green { println('green') }
|
||||
29| .green { println('green') }
|
||||
~~~~~~~~
|
||||
30| .blue { println('blue') }
|
||||
31| }
|
||||
27 | .red { println('red') }
|
||||
28 | .green { println('green') }
|
||||
29 | .green { println('green') }
|
||||
| ~~~~~~~~
|
||||
30 | .blue { println('blue') }
|
||||
31 | }
|
||||
vlib/v/checker/tests/match_duplicate_branch.v:34:3: error: match case `green` is handled more than once
|
||||
32| match c {
|
||||
33| .red, .green { println('red green') }
|
||||
34| .green { println('green') }
|
||||
~~~~~~~~
|
||||
35| else { println('else') }
|
||||
36| }
|
||||
32 | match c {
|
||||
33 | .red, .green { println('red green') }
|
||||
34 | .green { println('green') }
|
||||
| ~~~~~~~~
|
||||
35 | else { println('else') }
|
||||
36 | }
|
||||
vlib/v/checker/tests/match_duplicate_branch.v:43:3: error: match case `2` is handled more than once
|
||||
41| 1 { println('1') }
|
||||
42| 2 { println('2') }
|
||||
43| 2 { println('3') }
|
||||
~~~
|
||||
44| else { println('else') }
|
||||
45| }
|
||||
41 | 1 { println('1') }
|
||||
42 | 2 { println('2') }
|
||||
43 | 2 { println('3') }
|
||||
| ~~~
|
||||
44 | else { println('else') }
|
||||
45 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/match_else_last_expr.v:4:3: error: `else` must be the last branch of `match`
|
||||
2| match 1 {
|
||||
3| 1 { println('1') }
|
||||
4| else { println('else') }
|
||||
~~~~~~
|
||||
5| 4 { println('4') }
|
||||
6| }
|
||||
2 | match 1 {
|
||||
3 | 1 { println('1') }
|
||||
4 | else { println('else') }
|
||||
| ~~~~~~
|
||||
5 | 4 { println('4') }
|
||||
6 | }
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
vlib/v/checker/tests/match_expr_else.v:5:6: error: match must be exhaustive (add match branches for: `f64` or `else {}` at the end)
|
||||
3| fn main() {
|
||||
4| x := A('test')
|
||||
5| _ = match x {
|
||||
~~~~~~~~~
|
||||
6| int {
|
||||
7| 'int'
|
||||
3 | fn main() {
|
||||
4 | x := A('test')
|
||||
5 | _ = match x {
|
||||
| ~~~~~~~~~
|
||||
6 | int {
|
||||
7 | 'int'
|
||||
vlib/v/checker/tests/match_expr_else.v:23:3: error: match expression is exhaustive, `else` is unnecessary
|
||||
21| 'f64'
|
||||
22| }
|
||||
23| else {
|
||||
~~~~~~
|
||||
24| 'else'
|
||||
25| }
|
||||
21 | 'f64'
|
||||
22 | }
|
||||
23 | else {
|
||||
| ~~~~~~
|
||||
24 | 'else'
|
||||
25 | }
|
||||
vlib/v/checker/tests/match_expr_else.v:34:3: error: `else` must be the last branch of `match`
|
||||
32| 'string'
|
||||
33| }
|
||||
34| else {
|
||||
~~~~~~
|
||||
35| 'else'
|
||||
36| }
|
||||
32 | 'string'
|
||||
33 | }
|
||||
34 | else {
|
||||
| ~~~~~~
|
||||
35 | 'else'
|
||||
36 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/match_undefined_cond.v:4:15: error: undefined: `Asd`
|
||||
2|
|
||||
3| fn main() {
|
||||
4| res := match Asd {
|
||||
~~~
|
||||
5| 1 { 'foo' }
|
||||
6| 2 { 'test' }
|
||||
2 |
|
||||
3 | fn main() {
|
||||
4 | res := match Asd {
|
||||
| ~~~
|
||||
5 | 1 { 'foo' }
|
||||
6 | 2 { 'test' }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/minus_op_wrong_left_type_err_a.v:3:5: error: mismatched types `A` and `int`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| A{} - 10
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | A{} - 10
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/minus_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `int`
|
||||
1| fn main() {
|
||||
2| [1,2,3] - 10
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | [1,2,3] - 10
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/minus_op_wrong_left_type_err_c.v:3:5: error: mismatched types `map_string_int` and `int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| a - 10
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | a - 10
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/minus_op_wrong_right_type_err_a.v:3:10: error: mismatched types `int` and `A`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| 10 - A{}
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | 10 - A{}
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/minus_op_wrong_right_type_err_b.v:2:10: error: mismatched types `int` and `array_int`
|
||||
1| fn main() {
|
||||
2| 10 - [1,2,3]
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 10 - [1,2,3]
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/minus_op_wrong_right_type_err_c.v:3:10: error: mismatched types `int` and `map_string_int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| 10 - a
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | 10 - a
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_left_type_err_a.v:2:2: error: mismatched types `f64` and `int`
|
||||
1| fn main() {
|
||||
2| 0.5 % 1
|
||||
~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 0.5 % 1
|
||||
| ~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_left_type_err_b.v:2:2: error: mismatched types `array_int` and `int`
|
||||
1| fn main() {
|
||||
2| [1,2,3] % 1
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | [1,2,3] % 1
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_left_type_err_c.v:4:2: error: mismatched types `A` and `int`
|
||||
2| fn main() {
|
||||
3| a := A{}
|
||||
4| a % 1
|
||||
^
|
||||
5| }
|
||||
2 | fn main() {
|
||||
3 | a := A{}
|
||||
4 | a % 1
|
||||
| ^
|
||||
5 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_left_type_err_d.v:3:2: error: mismatched types `map_string_int` and `int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| a % 1
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | a % 1
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_right_type_err_a.v:2:6: error: mismatched types `int` and `f64`
|
||||
1| fn main() {
|
||||
2| 1 % 0.5
|
||||
~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 1 % 0.5
|
||||
| ~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_right_type_err_b.v:2:6: error: mismatched types `int` and `array_int`
|
||||
1| fn main() {
|
||||
2| 1 % [1,2,3]
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 1 % [1,2,3]
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_right_type_err_c.v:4:6: error: mismatched types `int` and `A`
|
||||
2| fn main() {
|
||||
3| a := A{}
|
||||
4| 1 % a
|
||||
^
|
||||
5| }
|
||||
2 | fn main() {
|
||||
3 | a := A{}
|
||||
4 | 1 % a
|
||||
| ^
|
||||
5 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mod_op_wrong_right_type_err_d.v:3:6: error: mismatched types `int` and `map_string_int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| 1 % a
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | 1 % a
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mul_op_wrong_left_type_err_a.v:3:5: error: mismatched types `A` and `int`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| A{} * 10
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | A{} * 10
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/mul_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `int`
|
||||
1| fn main() {
|
||||
2| [1,2,3] * 10
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | [1,2,3] * 10
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mul_op_wrong_left_type_err_c.v:3:5: error: mismatched types `map_string_int` and `int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| a * 10
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | a * 10
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mul_op_wrong_right_type_err_a.v:3:10: error: mismatched types `int` and `A`
|
||||
1| struct A{}
|
||||
2| fn main() {
|
||||
3| 10 * A{}
|
||||
~~~
|
||||
4| }
|
||||
1 | struct A{}
|
||||
2 | fn main() {
|
||||
3 | 10 * A{}
|
||||
| ~~~
|
||||
4 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/mul_op_wrong_right_type_err_b.v:2:10: error: mismatched types `int` and `array_int`
|
||||
1| fn main() {
|
||||
2| 10 * [1,2,3]
|
||||
~~~~~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 10 * [1,2,3]
|
||||
| ~~~~~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/mul_op_wrong_right_type_err_c.v:3:10: error: mismatched types `int` and `map_string_int`
|
||||
1| fn main() {
|
||||
2| a := map[string]int
|
||||
3| 10 * a
|
||||
^
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | a := map[string]int
|
||||
3 | 10 * a
|
||||
| ^
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/multi_const_field_name_duplicate_err.v:2:8: error: field name `aaa` duplicate
|
||||
1| const (aaa = 1)
|
||||
2| const (aaa = 2)
|
||||
~~~
|
||||
3| fn main() {
|
||||
4| println(aaa)
|
||||
1 | const (aaa = 1)
|
||||
2 | const (aaa = 2)
|
||||
| ~~~
|
||||
3 | fn main() {
|
||||
4 | println(aaa)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/no_fn_main.v:1:1: error: function `main` must be declared in the main module
|
||||
1| fn no_main() {
|
||||
^
|
||||
2| println('Hello world !')
|
||||
3| }
|
||||
1 | fn no_main() {
|
||||
| ^
|
||||
2 | println('Hello world !')
|
||||
3 | }
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
vlib/v/checker/tests/no_pub_in_main.v:3:1: error: type alias `Integer` in module main cannot be declared public
|
||||
1| module main
|
||||
2|
|
||||
3| pub type Integer = int
|
||||
~~~~~~~~~~~~~~~~
|
||||
4|
|
||||
5| pub type Float = f32 | f64
|
||||
1 | module main
|
||||
2 |
|
||||
3 | pub type Integer = int
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
4 |
|
||||
5 | pub type Float = f32 | f64
|
||||
vlib/v/checker/tests/no_pub_in_main.v:5:1: error: sum type `Float` in module main cannot be declared public
|
||||
3| pub type Integer = int
|
||||
4|
|
||||
5| pub type Float = f32 | f64
|
||||
~~~~~~~~~~~~~~
|
||||
6|
|
||||
7| // Buggy ATM
|
||||
3 | pub type Integer = int
|
||||
4 |
|
||||
5 | pub type Float = f32 | f64
|
||||
| ~~~~~~~~~~~~~~
|
||||
6 |
|
||||
7 | // Buggy ATM
|
||||
vlib/v/checker/tests/no_pub_in_main.v:10:1: error: enum `Color` in module main cannot be declared public
|
||||
8| // pub type Fn = fn () int
|
||||
9|
|
||||
10| pub enum Color {
|
||||
~~~~~~~~~~~~~~
|
||||
11| red
|
||||
12| green
|
||||
8 | // pub type Fn = fn () int
|
||||
9 |
|
||||
10 | pub enum Color {
|
||||
| ~~~~~~~~~~~~~~
|
||||
11 | red
|
||||
12 | green
|
||||
vlib/v/checker/tests/no_pub_in_main.v:16:1: error: const in module main cannot be declared public
|
||||
14| }
|
||||
15|
|
||||
16| pub const (
|
||||
~~~~~~~~~
|
||||
17| w = 'world'
|
||||
18| )
|
||||
14 | }
|
||||
15 |
|
||||
16 | pub const (
|
||||
| ~~~~~~~~~
|
||||
17 | w = 'world'
|
||||
18 | )
|
||||
vlib/v/checker/tests/no_pub_in_main.v:20:1: error: function `my_fn` in module main cannot be declared public
|
||||
18| )
|
||||
19|
|
||||
20| pub fn my_fn() int {
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
21| return 1
|
||||
22| }
|
||||
18 | )
|
||||
19 |
|
||||
20 | pub fn my_fn() int {
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
21 | return 1
|
||||
22 | }
|
||||
vlib/v/checker/tests/no_pub_in_main.v:24:1: error: function `main` cannot be declared public
|
||||
22| }
|
||||
23|
|
||||
24| pub fn main() {
|
||||
~~~~~~~~~~~~~
|
||||
25| println('main')
|
||||
26| }
|
||||
22 | }
|
||||
23 |
|
||||
24 | pub fn main() {
|
||||
| ~~~~~~~~~~~~~
|
||||
25 | println('main')
|
||||
26 | }
|
||||
vlib/v/checker/tests/no_pub_in_main.v:28:1: error: struct `MyStruct` in module main cannot be declared public
|
||||
26| }
|
||||
27|
|
||||
28| pub struct MyStruct {
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
29| field int
|
||||
30| }
|
||||
26 | }
|
||||
27 |
|
||||
28 | pub struct MyStruct {
|
||||
| ~~~~~~~~~~~~~~~~~~~
|
||||
29 | field int
|
||||
30 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/reference_field_must_be_initialized.v:8:7: error: reference field `Node.next` must be initialized
|
||||
6|
|
||||
7| fn main(){
|
||||
8| n := Node{ data: 123 }
|
||||
~~~~~~~~~~~~~~~~~
|
||||
9| eprintln('n.data: $n.data')
|
||||
10| }
|
||||
6 |
|
||||
7 | fn main(){
|
||||
8 | n := Node{ data: 123 }
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
9 | eprintln('n.data: $n.data')
|
||||
10 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/return_type.v:2:9: error: cannot use `int` as type `bool` in return argument
|
||||
1| fn test() bool {
|
||||
2| return 100
|
||||
~~~
|
||||
3| }
|
||||
4|
|
||||
1 | fn test() bool {
|
||||
2 | return 100
|
||||
| ~~~
|
||||
3 | }
|
||||
4 |
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/shift_op_wrong_left_type_err.v:2:2: error: cannot shift type int into non-integer type f64
|
||||
1| fn main() {
|
||||
2| 0.5 << 1
|
||||
~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 0.5 << 1
|
||||
| ~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/shift_op_wrong_right_type_err.v:2:7: error: cannot shift non-integer type f64 into type int
|
||||
1| fn main() {
|
||||
2| 1 << 0.5
|
||||
~~~
|
||||
3| }
|
||||
1 | fn main() {
|
||||
2 | 1 << 0.5
|
||||
| ~~~
|
||||
3 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/short_struct_too_many.v:6:7: error: too many fields
|
||||
4|
|
||||
5| fn main() {
|
||||
6| t := Test{true, false}
|
||||
~~~~~~~~~~~~~~~~~
|
||||
7| _ = t
|
||||
8| }
|
||||
4 |
|
||||
5 | fn main() {
|
||||
6 | t := Test{true, false}
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
7 | _ = t
|
||||
8 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/struct_field_name_duplicate_err.v:3:4: error: field name `a` duplicate
|
||||
1| struct A {
|
||||
2| a int
|
||||
3| a string
|
||||
~~~~~~
|
||||
4| }
|
||||
5| fn main(){}
|
||||
1 | struct A {
|
||||
2 | a int
|
||||
3 | a string
|
||||
| ~~~~~~
|
||||
4 | }
|
||||
5 | fn main(){}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/struct_name.v:1:8: error: struct name must begin with capital letter
|
||||
1| struct abc {
|
||||
~~~
|
||||
2|
|
||||
3| }
|
||||
1 | struct abc {
|
||||
| ~~~
|
||||
2 |
|
||||
3 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/struct_pub_field.v:9:4: error: field `i` of struct `A` is immutable
|
||||
7| i: 1
|
||||
8| }
|
||||
9| a.i = 2
|
||||
^
|
||||
10| }
|
||||
7 | i: 1
|
||||
8 | }
|
||||
9 | a.i = 2
|
||||
| ^
|
||||
10 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/struct_unknown_field.v:8:9: error: unknown field `bar` in struct literal of type `Test`
|
||||
6| t := Test{
|
||||
7| foo: true
|
||||
8| bar: false
|
||||
~~~~~~~~~~
|
||||
9| }
|
||||
10| _ = t
|
||||
6 | t := Test{
|
||||
7 | foo: true
|
||||
8 | bar: false
|
||||
| ~~~~~~~~~~
|
||||
9 | }
|
||||
10 | _ = t
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
vlib/v/checker/tests/sum_type_exists.v:1:1: error: type `Nope` doesn't exist
|
||||
1| type Miscellaneous = Nope | Inexistant | int
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
2|
|
||||
3| fn main() {
|
||||
1 | type Miscellaneous = Nope | Inexistant | int
|
||||
| ~~~~~~~~~~~~~~~~~~
|
||||
2 |
|
||||
3 | fn main() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/ternary_mismatch.v:2:7: error: mismatched types `string` and `int`
|
||||
1| fn main() {
|
||||
2| s := if true { '12' } else { 12 }
|
||||
~~
|
||||
3| println(s)
|
||||
4| }
|
||||
1 | fn main() {
|
||||
2 | s := if true { '12' } else { 12 }
|
||||
| ~~
|
||||
3 | println(s)
|
||||
4 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/unknown_field.v:7:12: error: unknown field `Test.sdd`
|
||||
5| fn main() {
|
||||
6| t := Test{}
|
||||
7| println(t.sdd)
|
||||
~~~
|
||||
8| }
|
||||
5 | fn main() {
|
||||
6 | t := Test{}
|
||||
7 | println(t.sdd)
|
||||
| ~~~
|
||||
8 | }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
vlib/v/checker/tests/unknown_method.v:7:12: error: unknown method: `Test.sdd`
|
||||
5| fn main() {
|
||||
6| t := Test{}
|
||||
7| println(t.sdd())
|
||||
~~~~~
|
||||
8| }
|
||||
5 | fn main() {
|
||||
6 | t := Test{}
|
||||
7 | println(t.sdd())
|
||||
| ~~~~~
|
||||
8 | }
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
vlib/v/checker/tests/unnecessary_parenthesis.v:2:2: error: unnecessary `()` in an if condition. use `if expr {` instead of `if (expr) {`.
|
||||
1| fn main() {
|
||||
2| if (1 == 1) {
|
||||
~~~~~~~~~~~
|
||||
3| println('yeay')
|
||||
4| } else if (1 == 2) {
|
||||
1 | fn main() {
|
||||
2 | if (1 == 1) {
|
||||
| ~~~~~~~~~~~
|
||||
3 | println('yeay')
|
||||
4 | } else if (1 == 2) {
|
||||
vlib/v/checker/tests/unnecessary_parenthesis.v:4:4: error: unnecessary `()` in an if condition. use `if expr {` instead of `if (expr) {`.
|
||||
2| if (1 == 1) {
|
||||
3| println('yeay')
|
||||
4| } else if (1 == 2) {
|
||||
~~~~~~~~~~~~~~~~
|
||||
5| println("oh no :'(")
|
||||
6| } else if (1 == 3) {
|
||||
2 | if (1 == 1) {
|
||||
3 | println('yeay')
|
||||
4 | } else if (1 == 2) {
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
5 | println("oh no :'(")
|
||||
6 | } else if (1 == 3) {
|
||||
vlib/v/checker/tests/unnecessary_parenthesis.v:6:4: error: unnecessary `()` in an if condition. use `if expr {` instead of `if (expr) {`.
|
||||
4| } else if (1 == 2) {
|
||||
5| println("oh no :'(")
|
||||
6| } else if (1 == 3) {
|
||||
~~~~~~~~~~~~~~~~
|
||||
7| println("what's wrong with physics ????")
|
||||
8| }
|
||||
4 | } else if (1 == 2) {
|
||||
5 | println("oh no :'(")
|
||||
6 | } else if (1 == 3) {
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
7 | println("what's wrong with physics ????")
|
||||
8 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/unreachable_code.v:3:7: error: unreachable code
|
||||
1| fn foo() int {
|
||||
2| return if 1 == 1 { 1 } else { 2 }
|
||||
3| a := 1
|
||||
^
|
||||
4| println(a)
|
||||
5| }
|
||||
1 | fn foo() int {
|
||||
2 | return if 1 == 1 { 1 } else { 2 }
|
||||
3 | a := 1
|
||||
| ^
|
||||
4 | println(a)
|
||||
5 | }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/void_fn_as_value.v:5:8: error: unknown function: x
|
||||
3| fn main() {
|
||||
4| mut a := 'aa'
|
||||
5| a += x('a','b')
|
||||
~~~~~~~~~~
|
||||
6| mut b := 'abcdef'
|
||||
7| _ = b
|
||||
3 | fn main() {
|
||||
4 | mut a := 'aa'
|
||||
5 | a += x('a','b')
|
||||
| ~~~~~~~~~~
|
||||
6 | mut b := 'abcdef'
|
||||
7 | _ = b
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
vlib/v/checker/tests/void_function_assign_to_string.v:6:6: error: cannot assign `void` to variable `a` of type `string`
|
||||
4| fn main(){
|
||||
5| mut a := ''
|
||||
6| a = x(1,2) // hello
|
||||
~~~~~~
|
||||
7| eprintln('a: $a')
|
||||
8| }
|
||||
4 | fn main(){
|
||||
5 | mut a := ''
|
||||
6 | a = x(1,2) // hello
|
||||
| ~~~~~~
|
||||
7 | eprintln('a: $a')
|
||||
8 | }
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue