checker: better << error
parent
fca11dd441
commit
b0018ed594
|
@ -399,7 +399,7 @@ pub fn (mut c Checker) infix_expr(infix_expr mut ast.InfixExpr) table.Type {
|
|||
// []T << []T
|
||||
return table.void_type
|
||||
}
|
||||
c.error('cannot shift type $right.name into $left.name', infix_expr.right.position())
|
||||
c.error('cannot append `$right.name` to `$left.name`', 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())
|
||||
|
@ -1035,8 +1035,7 @@ pub fn (mut c Checker) assign_stmt(assign_stmt mut ast.AssignStmt) {
|
|||
assign_stmt.pos)
|
||||
return
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if assign_stmt.left.len != assign_stmt.right.len {
|
||||
c.error('assignment mismatch: $assign_stmt.left.len variable(s) $assign_stmt.right.len value(s)',
|
||||
assign_stmt.pos)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
vlib/v/checker/tests/left_shift_err.v:3:7: error: cannot shift type string into array_int
|
||||
vlib/v/checker/tests/left_shift_err.v:3:7: error: cannot append `string` to `array_int`
|
||||
1 | fn main() {
|
||||
2 | mut l := []int{}
|
||||
3 | l << 'test'
|
||||
|
|
Loading…
Reference in New Issue