1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: use []int instead of array_int in errors

This commit is contained in:
Alexander Medvednikov 2020-05-03 16:49:05 +02:00
parent 2a5421133d
commit 2a016d03ac
2 changed files with 3 additions and 2 deletions

View File

@ -399,7 +399,8 @@ pub fn (mut c Checker) infix_expr(infix_expr mut ast.InfixExpr) table.Type {
// []T << []T
return table.void_type
}
c.error('cannot append `$right.name` to `$left.name`', infix_expr.right.position())
s := left.name.replace('array_', '[]')
c.error('cannot append `$right.name` to `$s', infix_expr.right.position())
return table.void_type
} else if !left.is_int() {
c.error('cannot shift type $right.name into non-integer type $left.name', infix_expr.left.position())

View File

@ -1,4 +1,4 @@
vlib/v/checker/tests/left_shift_err.v:3:7: error: cannot append `string` to `array_int`
vlib/v/checker/tests/left_shift_err.v:3:7: error: cannot append `string` to `[]int`
1 | fn main() {
2 | mut l := []int{}
3 | l << 'test'