diff --git a/vlib/v/checker/tests/add_op_wrong_left_type_err_a.out b/vlib/v/checker/tests/add_op_wrong_left_type_err_a.out index 5218880bc5..a42c15343d 100644 --- a/vlib/v/checker/tests/add_op_wrong_left_type_err_a.out +++ b/vlib/v/checker/tests/add_op_wrong_left_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/add_op_wrong_left_type_err_a.v:3:5: error: mismatched types `Aaa` and `any_int` +vlib/v/checker/tests/add_op_wrong_left_type_err_a.v:3:13: error: mismatched types `Aaa` and `any_int` 1 | struct Aaa{} 2 | fn main() { - 3 | Aaa{} + 10 - | ~~~~~ + 3 | println(Aaa{} + 10) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/add_op_wrong_left_type_err_a.vv b/vlib/v/checker/tests/add_op_wrong_left_type_err_a.vv index 625abda679..72c6319942 100644 --- a/vlib/v/checker/tests/add_op_wrong_left_type_err_a.vv +++ b/vlib/v/checker/tests/add_op_wrong_left_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - Aaa{} + 10 + println(Aaa{} + 10) } diff --git a/vlib/v/checker/tests/add_op_wrong_left_type_err_b.out b/vlib/v/checker/tests/add_op_wrong_left_type_err_b.out index 864151db2c..bb221eb923 100644 --- a/vlib/v/checker/tests/add_op_wrong_left_type_err_b.out +++ b/vlib/v/checker/tests/add_op_wrong_left_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/add_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `any_int` +vlib/v/checker/tests/add_op_wrong_left_type_err_b.v:2:13: error: mismatched types `array_int` and `any_int` 1 | fn main() { - 2 | [1,2,3] + 10 - | ~~~~~~~ + 2 | println([1,2,3] + 10) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/add_op_wrong_left_type_err_b.vv b/vlib/v/checker/tests/add_op_wrong_left_type_err_b.vv index f75bfb8c6a..c87da722a9 100644 --- a/vlib/v/checker/tests/add_op_wrong_left_type_err_b.vv +++ b/vlib/v/checker/tests/add_op_wrong_left_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - [1,2,3] + 10 + println([1,2,3] + 10) } diff --git a/vlib/v/checker/tests/add_op_wrong_left_type_err_c.out b/vlib/v/checker/tests/add_op_wrong_left_type_err_c.out index 7f260d0c2e..af6d21b9eb 100644 --- a/vlib/v/checker/tests/add_op_wrong_left_type_err_c.out +++ b/vlib/v/checker/tests/add_op_wrong_left_type_err_c.out @@ -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 `any_int` +vlib/v/checker/tests/add_op_wrong_left_type_err_c.v:3:13: error: mismatched types `map_string_int` and `any_int` 1 | fn main() { 2 | a := map[string]int - 3 | a + 10 - | ^ + 3 | println(a + 10) + | ^ 4 | } diff --git a/vlib/v/checker/tests/add_op_wrong_left_type_err_c.vv b/vlib/v/checker/tests/add_op_wrong_left_type_err_c.vv index 497b3f95aa..fba4f3a251 100644 --- a/vlib/v/checker/tests/add_op_wrong_left_type_err_c.vv +++ b/vlib/v/checker/tests/add_op_wrong_left_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - a + 10 + println(a + 10) } diff --git a/vlib/v/checker/tests/add_op_wrong_right_type_err_a.out b/vlib/v/checker/tests/add_op_wrong_right_type_err_a.out index 922ea4c658..dd7eb74cfa 100644 --- a/vlib/v/checker/tests/add_op_wrong_right_type_err_a.out +++ b/vlib/v/checker/tests/add_op_wrong_right_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/add_op_wrong_right_type_err_a.v:3:10: error: mismatched types `any_int` and `Aaa` +vlib/v/checker/tests/add_op_wrong_right_type_err_a.v:3:18: error: mismatched types `any_int` and `Aaa` 1 | struct Aaa{} 2 | fn main() { - 3 | 10 + Aaa{} - | ~~~~~ + 3 | println(10 + Aaa{}) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/add_op_wrong_right_type_err_a.vv b/vlib/v/checker/tests/add_op_wrong_right_type_err_a.vv index 01af6499a3..1be1ffb7ff 100644 --- a/vlib/v/checker/tests/add_op_wrong_right_type_err_a.vv +++ b/vlib/v/checker/tests/add_op_wrong_right_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - 10 + Aaa{} + println(10 + Aaa{}) } diff --git a/vlib/v/checker/tests/add_op_wrong_right_type_err_b.out b/vlib/v/checker/tests/add_op_wrong_right_type_err_b.out index 8d61f81c2a..2704f84399 100644 --- a/vlib/v/checker/tests/add_op_wrong_right_type_err_b.out +++ b/vlib/v/checker/tests/add_op_wrong_right_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/add_op_wrong_right_type_err_b.v:2:10: error: mismatched types `any_int` and `array_int` +vlib/v/checker/tests/add_op_wrong_right_type_err_b.v:2:18: error: mismatched types `any_int` and `array_int` 1 | fn main() { - 2 | 10 + [1,2,3] - | ~~~~~~~ + 2 | println(10 + [1,2,3]) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/add_op_wrong_right_type_err_b.vv b/vlib/v/checker/tests/add_op_wrong_right_type_err_b.vv index ad55530f74..4987ddb2bc 100644 --- a/vlib/v/checker/tests/add_op_wrong_right_type_err_b.vv +++ b/vlib/v/checker/tests/add_op_wrong_right_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - 10 + [1,2,3] + println(10 + [1,2,3]) } diff --git a/vlib/v/checker/tests/add_op_wrong_right_type_err_c.out b/vlib/v/checker/tests/add_op_wrong_right_type_err_c.out index 085c32fb86..2215311846 100644 --- a/vlib/v/checker/tests/add_op_wrong_right_type_err_c.out +++ b/vlib/v/checker/tests/add_op_wrong_right_type_err_c.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/add_op_wrong_right_type_err_c.v:3:10: error: mismatched types `any_int` and `map_string_int` +vlib/v/checker/tests/add_op_wrong_right_type_err_c.v:3:18: error: mismatched types `any_int` and `map_string_int` 1 | fn main() { 2 | a := map[string]int - 3 | 10 + a - | ^ + 3 | println(10 + a) + | ^ 4 | } diff --git a/vlib/v/checker/tests/add_op_wrong_right_type_err_c.vv b/vlib/v/checker/tests/add_op_wrong_right_type_err_c.vv index 1be1402479..dd18d52375 100644 --- a/vlib/v/checker/tests/add_op_wrong_right_type_err_c.vv +++ b/vlib/v/checker/tests/add_op_wrong_right_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - 10 + a + println(10 + a) } diff --git a/vlib/v/checker/tests/bit_op_wrong_left_type_err.out b/vlib/v/checker/tests/bit_op_wrong_left_type_err.out index 0077eeff03..d2f2394b30 100644 --- a/vlib/v/checker/tests/bit_op_wrong_left_type_err.out +++ b/vlib/v/checker/tests/bit_op_wrong_left_type_err.out @@ -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 any_float +vlib/v/checker/tests/bit_op_wrong_left_type_err.v:2:10: error: left type of `&` cannot be non-integer type any_float 1 | fn main() { - 2 | 0.5 & 1 - | ~~~ + 2 | println(0.5 & 1) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/bit_op_wrong_left_type_err.vv b/vlib/v/checker/tests/bit_op_wrong_left_type_err.vv index 362cba79bc..60b0da585a 100644 --- a/vlib/v/checker/tests/bit_op_wrong_left_type_err.vv +++ b/vlib/v/checker/tests/bit_op_wrong_left_type_err.vv @@ -1,3 +1,3 @@ fn main() { - 0.5 & 1 + println(0.5 & 1) } \ No newline at end of file diff --git a/vlib/v/checker/tests/bit_op_wrong_right_type_err.out b/vlib/v/checker/tests/bit_op_wrong_right_type_err.out index 3e36bb91a1..68f7359658 100644 --- a/vlib/v/checker/tests/bit_op_wrong_right_type_err.out +++ b/vlib/v/checker/tests/bit_op_wrong_right_type_err.out @@ -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 any_float +vlib/v/checker/tests/bit_op_wrong_right_type_err.v:2:14: error: right type of `|` cannot be non-integer type any_float 1 | fn main() { - 2 | 1 | 0.5 - | ~~~ + 2 | println(1 | 0.5) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/bit_op_wrong_right_type_err.vv b/vlib/v/checker/tests/bit_op_wrong_right_type_err.vv index 8bdcbc593f..d9da95c0ca 100644 --- a/vlib/v/checker/tests/bit_op_wrong_right_type_err.vv +++ b/vlib/v/checker/tests/bit_op_wrong_right_type_err.vv @@ -1,3 +1,3 @@ fn main() { - 1 | 0.5 + println(1 | 0.5) } \ No newline at end of file diff --git a/vlib/v/checker/tests/div_op_wrong_left_type_err_a.out b/vlib/v/checker/tests/div_op_wrong_left_type_err_a.out index 83027ae65f..78bd4d8a66 100644 --- a/vlib/v/checker/tests/div_op_wrong_left_type_err_a.out +++ b/vlib/v/checker/tests/div_op_wrong_left_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/div_op_wrong_left_type_err_a.v:3:5: error: mismatched types `Aaa` and `any_int` +vlib/v/checker/tests/div_op_wrong_left_type_err_a.v:3:13: error: mismatched types `Aaa` and `any_int` 1 | struct Aaa{} 2 | fn main() { - 3 | Aaa{} / 10 - | ~~~~~ + 3 | println(Aaa{} / 10) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/div_op_wrong_left_type_err_a.vv b/vlib/v/checker/tests/div_op_wrong_left_type_err_a.vv index a8286b703f..82984d021d 100644 --- a/vlib/v/checker/tests/div_op_wrong_left_type_err_a.vv +++ b/vlib/v/checker/tests/div_op_wrong_left_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - Aaa{} / 10 + println(Aaa{} / 10) } diff --git a/vlib/v/checker/tests/div_op_wrong_left_type_err_b.out b/vlib/v/checker/tests/div_op_wrong_left_type_err_b.out index 3706ba2548..d00607cb77 100644 --- a/vlib/v/checker/tests/div_op_wrong_left_type_err_b.out +++ b/vlib/v/checker/tests/div_op_wrong_left_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/div_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `any_int` +vlib/v/checker/tests/div_op_wrong_left_type_err_b.v:2:13: error: mismatched types `array_int` and `any_int` 1 | fn main() { - 2 | [1,2,3] / 10 - | ~~~~~~~ + 2 | println([1,2,3] / 10) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/div_op_wrong_left_type_err_b.vv b/vlib/v/checker/tests/div_op_wrong_left_type_err_b.vv index 4dc9bc6ac6..4e89fc2a2a 100644 --- a/vlib/v/checker/tests/div_op_wrong_left_type_err_b.vv +++ b/vlib/v/checker/tests/div_op_wrong_left_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - [1,2,3] / 10 + println([1,2,3] / 10) } diff --git a/vlib/v/checker/tests/div_op_wrong_left_type_err_c.out b/vlib/v/checker/tests/div_op_wrong_left_type_err_c.out index 336adaf5df..240fa6ea4b 100644 --- a/vlib/v/checker/tests/div_op_wrong_left_type_err_c.out +++ b/vlib/v/checker/tests/div_op_wrong_left_type_err_c.out @@ -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 `any_int` +vlib/v/checker/tests/div_op_wrong_left_type_err_c.v:3:13: error: mismatched types `map_string_int` and `any_int` 1 | fn main() { 2 | a := map[string]int - 3 | a / 10 - | ^ + 3 | println(a / 10) + | ^ 4 | } diff --git a/vlib/v/checker/tests/div_op_wrong_left_type_err_c.vv b/vlib/v/checker/tests/div_op_wrong_left_type_err_c.vv index b326b68729..fca64f9ff8 100644 --- a/vlib/v/checker/tests/div_op_wrong_left_type_err_c.vv +++ b/vlib/v/checker/tests/div_op_wrong_left_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - a / 10 + println(a / 10) } diff --git a/vlib/v/checker/tests/div_op_wrong_right_type_err_a.out b/vlib/v/checker/tests/div_op_wrong_right_type_err_a.out index 017990d293..ef62bd695d 100644 --- a/vlib/v/checker/tests/div_op_wrong_right_type_err_a.out +++ b/vlib/v/checker/tests/div_op_wrong_right_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/div_op_wrong_right_type_err_a.v:3:10: error: mismatched types `any_int` and `Aaa` +vlib/v/checker/tests/div_op_wrong_right_type_err_a.v:3:18: error: mismatched types `any_int` and `Aaa` 1 | struct Aaa{} 2 | fn main() { - 3 | 10 / Aaa{} - | ~~~~~ + 3 | println(10 / Aaa{}) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/div_op_wrong_right_type_err_a.vv b/vlib/v/checker/tests/div_op_wrong_right_type_err_a.vv index 5abff6d9f8..b2e48704f2 100644 --- a/vlib/v/checker/tests/div_op_wrong_right_type_err_a.vv +++ b/vlib/v/checker/tests/div_op_wrong_right_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - 10 / Aaa{} + println(10 / Aaa{}) } diff --git a/vlib/v/checker/tests/div_op_wrong_right_type_err_b.out b/vlib/v/checker/tests/div_op_wrong_right_type_err_b.out index 4dca5f2ce2..f10d236c1d 100644 --- a/vlib/v/checker/tests/div_op_wrong_right_type_err_b.out +++ b/vlib/v/checker/tests/div_op_wrong_right_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/div_op_wrong_right_type_err_b.v:2:10: error: mismatched types `any_int` and `array_int` +vlib/v/checker/tests/div_op_wrong_right_type_err_b.v:2:18: error: mismatched types `any_int` and `array_int` 1 | fn main() { - 2 | 10 / [1,2,3] - | ~~~~~~~ + 2 | println(10 / [1,2,3]) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/div_op_wrong_right_type_err_b.vv b/vlib/v/checker/tests/div_op_wrong_right_type_err_b.vv index 0870d80a3d..5e0186de59 100644 --- a/vlib/v/checker/tests/div_op_wrong_right_type_err_b.vv +++ b/vlib/v/checker/tests/div_op_wrong_right_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - 10 / [1,2,3] + println(10 / [1,2,3]) } diff --git a/vlib/v/checker/tests/div_op_wrong_right_type_err_c.out b/vlib/v/checker/tests/div_op_wrong_right_type_err_c.out index 834c6f72ef..0b7df6bae0 100644 --- a/vlib/v/checker/tests/div_op_wrong_right_type_err_c.out +++ b/vlib/v/checker/tests/div_op_wrong_right_type_err_c.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/div_op_wrong_right_type_err_c.v:3:10: error: mismatched types `any_int` and `map_string_int` +vlib/v/checker/tests/div_op_wrong_right_type_err_c.v:3:18: error: mismatched types `any_int` and `map_string_int` 1 | fn main() { 2 | a := map[string]int - 3 | 10 / a - | ^ + 3 | println(10 / a) + | ^ 4 | } diff --git a/vlib/v/checker/tests/div_op_wrong_right_type_err_c.vv b/vlib/v/checker/tests/div_op_wrong_right_type_err_c.vv index f784c8c0e3..220a8baeaf 100644 --- a/vlib/v/checker/tests/div_op_wrong_right_type_err_c.vv +++ b/vlib/v/checker/tests/div_op_wrong_right_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - 10 / a + println(10 / a) } diff --git a/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.out b/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.out index 72c3384865..8f5aa743f6 100644 --- a/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.out +++ b/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/minus_op_wrong_left_type_err_a.v:3:5: error: mismatched types `Aaa` and `any_int` +vlib/v/checker/tests/minus_op_wrong_left_type_err_a.v:3:13: error: mismatched types `Aaa` and `any_int` 1 | struct Aaa{} 2 | fn main() { - 3 | Aaa{} - 10 - | ~~~~~ + 3 | println(Aaa{} - 10) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.vv b/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.vv index a4cbb0903e..26ed6d6f47 100644 --- a/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.vv +++ b/vlib/v/checker/tests/minus_op_wrong_left_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - Aaa{} - 10 + println(Aaa{} - 10) } diff --git a/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.out b/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.out index 65e835c096..ecb834e24c 100644 --- a/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.out +++ b/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/minus_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `any_int` +vlib/v/checker/tests/minus_op_wrong_left_type_err_b.v:2:13: error: mismatched types `array_int` and `any_int` 1 | fn main() { - 2 | [1,2,3] - 10 - | ~~~~~~~ + 2 | println([1,2,3] - 10) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.vv b/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.vv index 25a7ed323e..b213660e9a 100644 --- a/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.vv +++ b/vlib/v/checker/tests/minus_op_wrong_left_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - [1,2,3] - 10 + println([1,2,3] - 10) } diff --git a/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.out b/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.out index 714a7ee5b3..f676a63f24 100644 --- a/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.out +++ b/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.out @@ -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 `any_int` +vlib/v/checker/tests/minus_op_wrong_left_type_err_c.v:3:13: error: mismatched types `map_string_int` and `any_int` 1 | fn main() { 2 | a := map[string]int - 3 | a - 10 - | ^ + 3 | println(a - 10) + | ^ 4 | } diff --git a/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.vv b/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.vv index 083d54b3a9..815a7ae2fd 100644 --- a/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.vv +++ b/vlib/v/checker/tests/minus_op_wrong_left_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - a - 10 + println(a - 10) } diff --git a/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.out b/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.out index 68f30a760a..2f30a9c2b3 100644 --- a/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.out +++ b/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/minus_op_wrong_right_type_err_a.v:3:10: error: mismatched types `any_int` and `Aaa` +vlib/v/checker/tests/minus_op_wrong_right_type_err_a.v:3:18: error: mismatched types `any_int` and `Aaa` 1 | struct Aaa{} 2 | fn main() { - 3 | 10 - Aaa{} - | ~~~~~ + 3 | println(10 - Aaa{}) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.vv b/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.vv index 8a2d4511fc..24acd18665 100644 --- a/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.vv +++ b/vlib/v/checker/tests/minus_op_wrong_right_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - 10 - Aaa{} + println(10 - Aaa{}) } diff --git a/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.out b/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.out index 76a786551f..b35e4014b4 100644 --- a/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.out +++ b/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/minus_op_wrong_right_type_err_b.v:2:10: error: mismatched types `any_int` and `array_int` +vlib/v/checker/tests/minus_op_wrong_right_type_err_b.v:2:18: error: mismatched types `any_int` and `array_int` 1 | fn main() { - 2 | 10 - [1,2,3] - | ~~~~~~~ + 2 | println(10 - [1,2,3]) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.vv b/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.vv index d001d9bd2b..7db598d81f 100644 --- a/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.vv +++ b/vlib/v/checker/tests/minus_op_wrong_right_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - 10 - [1,2,3] + println(10 - [1,2,3]) } diff --git a/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.out b/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.out index 25c6184628..e3245d5c70 100644 --- a/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.out +++ b/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/minus_op_wrong_right_type_err_c.v:3:10: error: mismatched types `any_int` and `map_string_int` +vlib/v/checker/tests/minus_op_wrong_right_type_err_c.v:3:18: error: mismatched types `any_int` and `map_string_int` 1 | fn main() { 2 | a := map[string]int - 3 | 10 - a - | ^ + 3 | println(10 - a) + | ^ 4 | } diff --git a/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.vv b/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.vv index 7c73df41f3..76ff12d807 100644 --- a/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.vv +++ b/vlib/v/checker/tests/minus_op_wrong_right_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - 10 - a + println(10 - a) } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.out b/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.out index 86fb067512..207bb93414 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.out +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/mod_op_wrong_left_type_err_a.v:2:2: error: float modulo not allowed, use math.fmod() instead +vlib/v/checker/tests/mod_op_wrong_left_type_err_a.v:2:10: error: float modulo not allowed, use math.fmod() instead 1 | fn main() { - 2 | 0.5 % 1 - | ~~~ + 2 | println(0.5 % 1) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.vv b/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.vv index 175974c6a0..cc7217f268 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.vv +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_a.vv @@ -1,3 +1,3 @@ fn main() { - 0.5 % 1 + println(0.5 % 1) } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.out b/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.out index ac813150fc..4a00b7fd53 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.out +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/mod_op_wrong_left_type_err_b.v:2:2: error: mismatched types `array_int` and `any_int` +vlib/v/checker/tests/mod_op_wrong_left_type_err_b.v:2:10: error: mismatched types `array_int` and `any_int` 1 | fn main() { - 2 | [1,2,3] % 1 - | ~~~~~~~ + 2 | println([1,2,3] % 1) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.vv b/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.vv index 8e33fbbb6f..963fccd893 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.vv +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - [1,2,3] % 1 + println([1,2,3] % 1) } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.out b/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.out index 04ac5bb156..c8343b9a07 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.out +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/mod_op_wrong_left_type_err_c.v:4:2: error: mismatched types `Aaa` and `any_int` +vlib/v/checker/tests/mod_op_wrong_left_type_err_c.v:4:10: error: mismatched types `Aaa` and `any_int` 2 | fn main() { 3 | a := Aaa{} - 4 | a % 1 - | ^ + 4 | println(a % 1) + | ^ 5 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.vv b/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.vv index 9042a6b574..f05db5c2b5 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.vv +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_c.vv @@ -1,5 +1,5 @@ struct Aaa{} fn main() { a := Aaa{} - a % 1 + println(a % 1) } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.out b/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.out index bbf5235c3e..89081346f6 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.out +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.out @@ -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 `any_int` +vlib/v/checker/tests/mod_op_wrong_left_type_err_d.v:3:10: error: mismatched types `map_string_int` and `any_int` 1 | fn main() { 2 | a := map[string]int - 3 | a % 1 - | ^ + 3 | println(a % 1) + | ^ 4 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.vv b/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.vv index d4f76d671f..03b3831969 100644 --- a/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.vv +++ b/vlib/v/checker/tests/mod_op_wrong_left_type_err_d.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - a % 1 + println(a % 1) } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.out b/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.out index 989c42d4d0..82b6bb1e2d 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.out +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/mod_op_wrong_right_type_err_a.v:2:6: error: float modulo not allowed, use math.fmod() instead +vlib/v/checker/tests/mod_op_wrong_right_type_err_a.v:2:14: error: float modulo not allowed, use math.fmod() instead 1 | fn main() { - 2 | 1 % 0.5 - | ~~~ + 2 | println(1 % 0.5) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.vv b/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.vv index 9db1022bca..eb573a51dc 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.vv +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_a.vv @@ -1,3 +1,3 @@ fn main() { - 1 % 0.5 + println(1 % 0.5) } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.out b/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.out index d43282c508..b75db1d409 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.out +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/mod_op_wrong_right_type_err_b.v:2:6: error: mismatched types `any_int` and `array_int` +vlib/v/checker/tests/mod_op_wrong_right_type_err_b.v:2:14: error: mismatched types `any_int` and `array_int` 1 | fn main() { - 2 | 1 % [1,2,3] - | ~~~~~~~ + 2 | println(1 % [1,2,3]) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.vv b/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.vv index 2322fed1e3..bc6a3c6272 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.vv +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - 1 % [1,2,3] + println(1 % [1,2,3]) } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.out b/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.out index 29e91389f6..aa275ffb7b 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.out +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/mod_op_wrong_right_type_err_c.v:4:6: error: mismatched types `any_int` and `Aaa` +vlib/v/checker/tests/mod_op_wrong_right_type_err_c.v:4:14: error: mismatched types `any_int` and `Aaa` 2 | fn main() { 3 | a := Aaa{} - 4 | 1 % a - | ^ + 4 | println(1 % a) + | ^ 5 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.vv b/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.vv index 2cea370b63..dd691cf97d 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.vv +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_c.vv @@ -1,5 +1,5 @@ struct Aaa{} fn main() { a := Aaa{} - 1 % a + println(1 % a) } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.out b/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.out index 2dd072bd1f..592f608e99 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.out +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/mod_op_wrong_right_type_err_d.v:3:6: error: mismatched types `any_int` and `map_string_int` +vlib/v/checker/tests/mod_op_wrong_right_type_err_d.v:3:14: error: mismatched types `any_int` and `map_string_int` 1 | fn main() { 2 | a := map[string]int - 3 | 1 % a - | ^ + 3 | println(1 % a) + | ^ 4 | } diff --git a/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.vv b/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.vv index ca3730dec0..6478d580c5 100644 --- a/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.vv +++ b/vlib/v/checker/tests/mod_op_wrong_right_type_err_d.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - 1 % a + println(1 % a) } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out b/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out index 4f51e39b5d..5dc293a4ba 100644 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out +++ b/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/mul_op_wrong_left_type_err_a.v:3:5: error: mismatched types `Aaa` and `any_int` +vlib/v/checker/tests/mul_op_wrong_left_type_err_a.v:3:13: error: mismatched types `Aaa` and `any_int` 1 | struct Aaa{} 2 | fn main() { - 3 | Aaa{} * 10 - | ~~~~~ + 3 | println(Aaa{} * 10) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv b/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv index d5eb305ed8..67193c9dd3 100644 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv +++ b/vlib/v/checker/tests/mul_op_wrong_left_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - Aaa{} * 10 + println(Aaa{} * 10) } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out b/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out index 342042bc30..dca3eec12b 100644 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out +++ b/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/mul_op_wrong_left_type_err_b.v:2:5: error: mismatched types `array_int` and `any_int` +vlib/v/checker/tests/mul_op_wrong_left_type_err_b.v:2:13: error: mismatched types `array_int` and `any_int` 1 | fn main() { - 2 | [1,2,3] * 10 - | ~~~~~~~ + 2 | println([1,2,3] * 10) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv b/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv index d3db01f01f..26f7682ffd 100644 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv +++ b/vlib/v/checker/tests/mul_op_wrong_left_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - [1,2,3] * 10 + println([1,2,3] * 10) } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out b/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out index 3d1f7c5431..6d4b727280 100644 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out +++ b/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.out @@ -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 `any_int` +vlib/v/checker/tests/mul_op_wrong_left_type_err_c.v:3:13: error: mismatched types `map_string_int` and `any_int` 1 | fn main() { 2 | a := map[string]int - 3 | a * 10 - | ^ + 3 | println(a * 10) + | ^ 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv b/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv index 315f882862..305b401562 100644 --- a/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv +++ b/vlib/v/checker/tests/mul_op_wrong_left_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - a * 10 + println(a * 10) } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out b/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out index 5c7a6358cd..6b1bfdfcde 100644 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out +++ b/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/mul_op_wrong_right_type_err_a.v:3:10: error: mismatched types `any_int` and `Aaa` +vlib/v/checker/tests/mul_op_wrong_right_type_err_a.v:3:18: error: mismatched types `any_int` and `Aaa` 1 | struct Aaa{} 2 | fn main() { - 3 | 10 * Aaa{} - | ~~~~~ + 3 | println(10 * Aaa{}) + | ~~~~~ 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv b/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv index 19b900b19c..d98f0297b6 100644 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv +++ b/vlib/v/checker/tests/mul_op_wrong_right_type_err_a.vv @@ -1,4 +1,4 @@ struct Aaa{} fn main() { - 10 * Aaa{} + println(10 * Aaa{}) } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out b/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out index 210d9022a8..72f872432c 100644 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out +++ b/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/mul_op_wrong_right_type_err_b.v:2:10: error: mismatched types `any_int` and `array_int` +vlib/v/checker/tests/mul_op_wrong_right_type_err_b.v:2:18: error: mismatched types `any_int` and `array_int` 1 | fn main() { - 2 | 10 * [1,2,3] - | ~~~~~~~ + 2 | println(10 * [1,2,3]) + | ~~~~~~~ 3 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv b/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv index 29a136b9e5..0b30519af3 100644 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv +++ b/vlib/v/checker/tests/mul_op_wrong_right_type_err_b.vv @@ -1,3 +1,3 @@ fn main() { - 10 * [1,2,3] + println(10 * [1,2,3]) } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out b/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out index c32652ebca..b6004066b5 100644 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out +++ b/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.out @@ -1,6 +1,6 @@ -vlib/v/checker/tests/mul_op_wrong_right_type_err_c.v:3:10: error: mismatched types `any_int` and `map_string_int` +vlib/v/checker/tests/mul_op_wrong_right_type_err_c.v:3:18: error: mismatched types `any_int` and `map_string_int` 1 | fn main() { 2 | a := map[string]int - 3 | 10 * a - | ^ + 3 | println(10 * a) + | ^ 4 | } diff --git a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv b/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv index 80ef961943..c4b2d947af 100644 --- a/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv +++ b/vlib/v/checker/tests/mul_op_wrong_right_type_err_c.vv @@ -1,4 +1,4 @@ fn main() { a := map[string]int - 10 * a + println(10 * a) } diff --git a/vlib/v/checker/tests/rshift_op_wrong_left_type_err.out b/vlib/v/checker/tests/rshift_op_wrong_left_type_err.out index 761219a2a8..34b4621422 100644 --- a/vlib/v/checker/tests/rshift_op_wrong_left_type_err.out +++ b/vlib/v/checker/tests/rshift_op_wrong_left_type_err.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/rshift_op_wrong_left_type_err.v:2:2: error: cannot shift type any_int into non-integer type any_float +vlib/v/checker/tests/rshift_op_wrong_left_type_err.v:2:10: error: cannot shift type any_int into non-integer type any_float 1 | fn main() { - 2 | 0.5 >> 1 - | ~~~ + 2 | println(0.5 >> 1) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/rshift_op_wrong_left_type_err.vv b/vlib/v/checker/tests/rshift_op_wrong_left_type_err.vv index 5e4a471809..5ea5841326 100644 --- a/vlib/v/checker/tests/rshift_op_wrong_left_type_err.vv +++ b/vlib/v/checker/tests/rshift_op_wrong_left_type_err.vv @@ -1,3 +1,3 @@ fn main() { - 0.5 >> 1 + println(0.5 >> 1) } diff --git a/vlib/v/checker/tests/rshift_op_wrong_right_type_err.out b/vlib/v/checker/tests/rshift_op_wrong_right_type_err.out index a7103b8582..8d62e7bb6b 100644 --- a/vlib/v/checker/tests/rshift_op_wrong_right_type_err.out +++ b/vlib/v/checker/tests/rshift_op_wrong_right_type_err.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/rshift_op_wrong_right_type_err.v:2:7: error: cannot shift non-integer type any_float into type any_int +vlib/v/checker/tests/rshift_op_wrong_right_type_err.v:2:15: error: cannot shift non-integer type any_float into type any_int 1 | fn main() { - 2 | 1 >> 0.5 - | ~~~ + 2 | println(1 >> 0.5) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/rshift_op_wrong_right_type_err.vv b/vlib/v/checker/tests/rshift_op_wrong_right_type_err.vv index 22abd553d3..cd55344090 100644 --- a/vlib/v/checker/tests/rshift_op_wrong_right_type_err.vv +++ b/vlib/v/checker/tests/rshift_op_wrong_right_type_err.vv @@ -1,3 +1,3 @@ fn main() { - 1 >> 0.5 + println(1 >> 0.5) } diff --git a/vlib/v/checker/tests/shift_op_wrong_left_type_err.out b/vlib/v/checker/tests/shift_op_wrong_left_type_err.out index 29e58a57fb..209ae4dfe5 100644 --- a/vlib/v/checker/tests/shift_op_wrong_left_type_err.out +++ b/vlib/v/checker/tests/shift_op_wrong_left_type_err.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/shift_op_wrong_left_type_err.v:2:2: error: cannot shift type any_int into non-integer type any_float +vlib/v/checker/tests/shift_op_wrong_left_type_err.v:2:10: error: cannot shift type any_int into non-integer type any_float 1 | fn main() { - 2 | 0.5 << 1 - | ~~~ + 2 | println(0.5 << 1) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/shift_op_wrong_left_type_err.vv b/vlib/v/checker/tests/shift_op_wrong_left_type_err.vv index 5c0a8cb6fd..87409eb3d7 100644 --- a/vlib/v/checker/tests/shift_op_wrong_left_type_err.vv +++ b/vlib/v/checker/tests/shift_op_wrong_left_type_err.vv @@ -1,3 +1,3 @@ fn main() { - 0.5 << 1 + println(0.5 << 1) } \ No newline at end of file diff --git a/vlib/v/checker/tests/shift_op_wrong_right_type_err.out b/vlib/v/checker/tests/shift_op_wrong_right_type_err.out index 71ccb5e141..9d22d5023a 100644 --- a/vlib/v/checker/tests/shift_op_wrong_right_type_err.out +++ b/vlib/v/checker/tests/shift_op_wrong_right_type_err.out @@ -1,5 +1,5 @@ -vlib/v/checker/tests/shift_op_wrong_right_type_err.v:2:7: error: cannot shift non-integer type any_float into type any_int +vlib/v/checker/tests/shift_op_wrong_right_type_err.v:2:15: error: cannot shift non-integer type any_float into type any_int 1 | fn main() { - 2 | 1 << 0.5 - | ~~~ + 2 | println(1 << 0.5) + | ~~~ 3 | } diff --git a/vlib/v/checker/tests/shift_op_wrong_right_type_err.vv b/vlib/v/checker/tests/shift_op_wrong_right_type_err.vv index 5e8a85d179..0eb1328f37 100644 --- a/vlib/v/checker/tests/shift_op_wrong_right_type_err.vv +++ b/vlib/v/checker/tests/shift_op_wrong_right_type_err.vv @@ -1,3 +1,3 @@ fn main() { - 1 << 0.5 + println(1 << 0.5) } \ No newline at end of file diff --git a/vlib/v/fmt/tests/char_literal_backtick_keep.vv b/vlib/v/fmt/tests/char_literal_backtick_keep.vv index 24205a457a..6979e95bbc 100644 --- a/vlib/v/fmt/tests/char_literal_backtick_keep.vv +++ b/vlib/v/fmt/tests/char_literal_backtick_keep.vv @@ -1,3 +1,3 @@ fn char_backtick() { - `\`` + println(`\``) } diff --git a/vlib/v/fmt/tests/functions_input.vv b/vlib/v/fmt/tests/functions_input.vv index 9498dcfecb..f0341a7fa2 100644 --- a/vlib/v/fmt/tests/functions_input.vv +++ b/vlib/v/fmt/tests/functions_input.vv @@ -50,7 +50,7 @@ fn (f Foo) fn_with_optional() ?int { return 40 } -fn mut_array(a mut []int) { +fn mut_array(mut a []int) { println(1) } diff --git a/vlib/v/fmt/tests/string_quotes_expected.vv b/vlib/v/fmt/tests/string_quotes_expected.vv index be1a0c652a..b1730ce364 100644 --- a/vlib/v/fmt/tests/string_quotes_expected.vv +++ b/vlib/v/fmt/tests/string_quotes_expected.vv @@ -1,11 +1,11 @@ fn main() { - 'Hello world !' - 'This is correct !' - "It's okay" - 'This is "too"' + println('Hello world !') + println('This is correct !') + println("It's okay") + println('This is "too"') // TODO // 'I\'m not correctly formatted' => "I'm not correctly formatted" // "\"Everything on the internet is true\" - Albert Einstein, 1965" => '"Everything on the internet is true" - Albert Einstein, 1965' - 'I\'m out of idea "_"' + println('I\'m out of idea "_"') // "Definitely out \":'(\"" => 'Definitely out ":\'("' } diff --git a/vlib/v/fmt/tests/string_quotes_input.vv b/vlib/v/fmt/tests/string_quotes_input.vv index b83fabfe5b..6db23a4d87 100644 --- a/vlib/v/fmt/tests/string_quotes_input.vv +++ b/vlib/v/fmt/tests/string_quotes_input.vv @@ -1,11 +1,11 @@ fn main() { - "Hello world !" - 'This is correct !' - "It's okay" - 'This is "too"' + println("Hello world !") + println('This is correct !') + println("It's okay") + println('This is "too"') // TODO // 'I\'m not correctly formatted' => "I'm not correctly formatted" // "\"Everything on the internet is true\" - Albert Einstein, 1965" => '"Everything on the internet is true" - Albert Einstein, 1965' - 'I\'m out of idea "_"' + println('I\'m out of idea "_"') // "Definitely out \":'(\"" => 'Definitely out ":\'("' } diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 1db78c45a8..232ed44b70 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -73,7 +73,7 @@ pub fn parse_stmt(text string, table &table.Table, scope &ast.Scope) ast.Stmt { } p.init_parse_fns() p.read_first_token() - return p.stmt() + return p.stmt(false) } pub fn parse_text(text string, b_table &table.Table, pref &pref.Preferences, scope, global_scope &ast.Scope) ast.File { @@ -317,7 +317,7 @@ pub fn (mut p Parser) parse_block_no_scope(is_top_level bool) []ast.Stmt { mut stmts := []ast.Stmt{} if p.tok.kind != .rcbr { for { - stmts << p.stmt() + stmts << p.stmt(is_top_level) // p.warn('after stmt(): tok=$p.tok.str()') if p.tok.kind in [.eof, .rcbr] { break @@ -464,7 +464,7 @@ pub fn (mut p Parser) top_stmt() ast.Stmt { if p.pref.is_script && !p.pref.is_test { mut stmts := []ast.Stmt{} for p.tok.kind != .eof { - stmts << p.stmt() + stmts << p.stmt(false) } return ast.FnDecl{ name: 'main' @@ -500,7 +500,7 @@ pub fn (mut p Parser) comment() ast.Comment { } } -pub fn (mut p Parser) stmt() ast.Stmt { +pub fn (mut p Parser) stmt(is_top_level bool) ast.Stmt { p.is_stmt_ident = p.tok.kind == .name match p.tok.kind { .lcbr { @@ -530,7 +530,7 @@ pub fn (mut p Parser) stmt() ast.Stmt { return p.assign_stmt() } else if p.peek_tok.kind == .comma { // `a, b ...` - return p.parse_multi_expr() + return p.parse_multi_expr(is_top_level) } else if p.peek_tok.kind == .colon { // `label:` name := p.check_name() @@ -544,7 +544,7 @@ pub fn (mut p Parser) stmt() ast.Stmt { [.rcbr, .eof] { p.error_with_pos('`$p.tok.lit` evaluated but not used', p.tok.position()) } - return p.parse_multi_expr() + return p.parse_multi_expr(is_top_level) } .comment { return p.comment() @@ -613,7 +613,7 @@ pub fn (mut p Parser) stmt() ast.Stmt { } // literals, 'if', etc. in here else { - return p.parse_multi_expr() + return p.parse_multi_expr(is_top_level) } } } @@ -733,11 +733,12 @@ pub fn (mut p Parser) warn_with_pos(s string, pos token.Position) { } } -fn (mut p Parser) parse_multi_expr() ast.Stmt { +fn (mut p Parser) parse_multi_expr(is_top_level bool) ast.Stmt { // in here might be 1) multi-expr 2) multi-assign // 1, a, c ... } // multi-expression // a, mut b ... :=/= // multi-assign // collect things upto hard boundaries + tok_kind := p.tok.kind mut collected := []ast.Expr{} for { collected << p.expr(0) @@ -773,6 +774,11 @@ fn (mut p Parser) parse_multi_expr() ast.Stmt { }) pos: epos } + } else if is_top_level && collected.len > 0 && collected[0] !is ast.AssignExpr && + collected[0] !is ast.CallExpr && collected[0] !is ast.PostfixExpr && + !(collected[0] is ast.InfixExpr && (collected[0] as ast.InfixExpr).op == .left_shift) && + collected[0] !is ast.ComptimeCall && tok_kind !in [.key_if, .key_match] { + p.error_with_pos('expression evaluated but not used', collected[0].position()) } else { if collected.len == 1 { return ast.ExprStmt{ diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_a.out b/vlib/v/parser/tests/expr_evaluated_but_not_used_a.out new file mode 100644 index 0000000000..faf61f6dff --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_a.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_a.v:2:2: error: expression evaluated but not used + 1 | fn main() { + 2 | 'hello' + | ~~~~~~~ + 3 | } diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_a.vv b/vlib/v/parser/tests/expr_evaluated_but_not_used_a.vv new file mode 100644 index 0000000000..c4b6515208 --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_a.vv @@ -0,0 +1,3 @@ +fn main() { + 'hello' +} \ No newline at end of file diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_b.out b/vlib/v/parser/tests/expr_evaluated_but_not_used_b.out new file mode 100644 index 0000000000..592abd5dd7 --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_b.out @@ -0,0 +1,5 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_b.v:2:2: error: expression evaluated but not used + 1 | fn main() { + 2 | 22 + | ~~ + 3 | } diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_b.vv b/vlib/v/parser/tests/expr_evaluated_but_not_used_b.vv new file mode 100644 index 0000000000..cac3734e3e --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_b.vv @@ -0,0 +1,3 @@ +fn main() { + 22 +} \ No newline at end of file diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_c.out b/vlib/v/parser/tests/expr_evaluated_but_not_used_c.out new file mode 100644 index 0000000000..98a9669d02 --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_c.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_c.v:3:5: error: expression evaluated but not used + 1 | fn main() { + 2 | a := 10 + 3 | `b` + | ~~~ + 4 | println(a) + 5 | } diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_c.vv b/vlib/v/parser/tests/expr_evaluated_but_not_used_c.vv new file mode 100644 index 0000000000..863ce2fbf2 --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_c.vv @@ -0,0 +1,5 @@ +fn main() { + a := 10 + `b` + println(a) +} \ No newline at end of file diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_d.out b/vlib/v/parser/tests/expr_evaluated_but_not_used_d.out new file mode 100644 index 0000000000..0f88cbbb66 --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_d.out @@ -0,0 +1,7 @@ +vlib/v/parser/tests/expr_evaluated_but_not_used_d.v:4:5: error: expression evaluated but not used + 2 | a := 1 + 3 | b := 2 + 4 | a+b + | ~~~ + 5 | println(a*b) + 6 | } diff --git a/vlib/v/parser/tests/expr_evaluated_but_not_used_d.vv b/vlib/v/parser/tests/expr_evaluated_but_not_used_d.vv new file mode 100644 index 0000000000..d4cb9e1545 --- /dev/null +++ b/vlib/v/parser/tests/expr_evaluated_but_not_used_d.vv @@ -0,0 +1,6 @@ +fn main() { + a := 1 + b := 2 + a+b + println(a*b) +} \ No newline at end of file