mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ci: fix failing tests for compiler_errors_test.v
This commit is contained in:
parent
fd5a76a8ad
commit
da7adb5b1b
@ -1737,12 +1737,6 @@ pub fn (mut c Checker) assign_stmt(mut assign_stmt ast.AssignStmt) {
|
||||
assign_stmt.op !in [.assign, .decl_assign] && !c.inside_unsafe {
|
||||
c.warn('pointer arithmetic is only allowed in `unsafe` blocks', assign_stmt.pos)
|
||||
}
|
||||
// Dual sides check (compatibility check)
|
||||
if !is_blank_ident && !c.check_types(right_type_unwrapped, left_type_unwrapped) &&
|
||||
right_sym.kind != .placeholder {
|
||||
c.error('cannot assign `$right_sym.name` to `$left.str()` of type `$left_sym.name`',
|
||||
right.position())
|
||||
}
|
||||
if c.pref.translated {
|
||||
// TODO fix this in C2V instead, for example cast enums to int before using `|` on them.
|
||||
// TODO replace all c.pref.translated checks with `$if !translated` for performance
|
||||
@ -1795,6 +1789,12 @@ pub fn (mut c Checker) assign_stmt(mut assign_stmt ast.AssignStmt) {
|
||||
}
|
||||
else {}
|
||||
}
|
||||
// Dual sides check (compatibility check)
|
||||
if !is_blank_ident && !c.check_types(right_type_unwrapped, left_type_unwrapped) &&
|
||||
right_sym.kind != .placeholder {
|
||||
c.error('cannot assign `$right_sym.name` to `$left.str()` of type `$left_sym.name`',
|
||||
right.position())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/add_op_wrong_left_type_err_b.v:2:13: 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 `[]int` and `any_int`
|
||||
1 | fn main() {
|
||||
2 | println([1,2,3] + 10)
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/add_op_wrong_right_type_err_b.v:2:18: 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 `[]int`
|
||||
1 | fn main() {
|
||||
2 | println(10 + [1,2,3])
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/cannot_assign_array.v:9:11: error: cannot assign `array_fixed_f64_8` to `ctx.vb` of type `string`
|
||||
vlib/v/checker/tests/cannot_assign_array.v:9:11: error: cannot assign `[]fixed_f64_8` to `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]!!
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/div_op_wrong_left_type_err_b.v:2:13: 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 `[]int` and `any_int`
|
||||
1 | fn main() {
|
||||
2 | println([1,2,3] / 10)
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/div_op_wrong_right_type_err_b.v:2:18: 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 `[]int`
|
||||
1 | fn main() {
|
||||
2 | println(10 / [1,2,3])
|
||||
| ~~~~~~~
|
||||
|
@ -5,7 +5,7 @@ vlib/v/checker/tests/index_expr.v:3:7: error: type `int` does not support indexi
|
||||
| ~~~
|
||||
4 |
|
||||
5 | a := [2]
|
||||
vlib/v/checker/tests/index_expr.v:6:7: error: non-integer index `array_int` (array type `array_int`)
|
||||
vlib/v/checker/tests/index_expr.v:6:7: error: non-integer index `[]int` (array type `[]int`)
|
||||
4 |
|
||||
5 | a := [2]
|
||||
6 | _ = a[a]
|
||||
@ -26,14 +26,14 @@ vlib/v/checker/tests/index_expr.v:12:7: error: type `int` does not support index
|
||||
| ~~~~~
|
||||
13 |
|
||||
14 | a := [2]
|
||||
vlib/v/checker/tests/index_expr.v:15:7: error: non-integer index `array_int` (array type `array_int`)
|
||||
vlib/v/checker/tests/index_expr.v:15:7: error: non-integer index `[]int` (array type `[]int`)
|
||||
13 |
|
||||
14 | a := [2]
|
||||
15 | _ = a[a..]
|
||||
| ~~~~~
|
||||
16 | _ = a[..a]
|
||||
17 | }
|
||||
vlib/v/checker/tests/index_expr.v:16:7: error: non-integer index `array_int` (array type `array_int`)
|
||||
vlib/v/checker/tests/index_expr.v:16:7: error: non-integer index `[]int` (array type `[]int`)
|
||||
14 | a := [2]
|
||||
15 | _ = a[a..]
|
||||
16 | _ = a[..a]
|
||||
|
@ -31,11 +31,11 @@ fn main() {
|
||||
string {
|
||||
'string'
|
||||
}
|
||||
f64 {
|
||||
'f64'
|
||||
}
|
||||
else {
|
||||
'else'
|
||||
}
|
||||
f64 {
|
||||
'f64'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/minus_op_wrong_left_type_err_b.v:2:13: 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 `[]int` and `any_int`
|
||||
1 | fn main() {
|
||||
2 | println([1,2,3] - 10)
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/minus_op_wrong_right_type_err_b.v:2:18: 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 `[]int`
|
||||
1 | fn main() {
|
||||
2 | println(10 - [1,2,3])
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/mod_op_wrong_left_type_err_b.v:2:10: 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 `[]int` and `any_int`
|
||||
1 | fn main() {
|
||||
2 | println([1,2,3] % 1)
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/mod_op_wrong_right_type_err_b.v:2:14: 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 `[]int`
|
||||
1 | fn main() {
|
||||
2 | println(1 % [1,2,3])
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/mul_op_wrong_left_type_err_b.v:2:13: 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 `[]int` and `any_int`
|
||||
1 | fn main() {
|
||||
2 | println([1,2,3] * 10)
|
||||
| ~~~~~~~
|
||||
|
@ -1,4 +1,4 @@
|
||||
vlib/v/checker/tests/mul_op_wrong_right_type_err_b.v:2:18: 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 `[]int`
|
||||
1 | fn main() {
|
||||
2 | println(10 * [1,2,3])
|
||||
| ~~~~~~~
|
||||
|
Loading…
Reference in New Issue
Block a user