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

checker: fix the void type check

This commit is contained in:
Alexander Medvednikov 2021-09-14 01:02:20 +03:00
parent b63ec8fbcf
commit 12ec900d20

View File

@ -3901,11 +3901,12 @@ pub fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) {
} }
if node.left.len != right_len { if node.left.len != right_len {
if right_first is ast.CallExpr { if right_first is ast.CallExpr {
if node.left_types.len > 0 && node.left_types[0] != ast.void_type { if node.left_types.len > 0 && node.left_types[0] == ast.void_type {
// If it's a void type, it's an unknown variable, already had an error earlier. // If it's a void type, it's an unknown variable, already had an error earlier.
return
}
c.error('assignment mismatch: $node.left.len variable(s) but `${right_first.name}()` returns $right_len value(s)', c.error('assignment mismatch: $node.left.len variable(s) but `${right_first.name}()` returns $right_len value(s)',
node.pos) node.pos)
}
} else { } else {
c.error('assignment mismatch: $node.left.len variable(s) $right_len value(s)', c.error('assignment mismatch: $node.left.len variable(s) $right_len value(s)',
node.pos) node.pos)