diff --git a/examples/gg/fire.v b/examples/gg/fire.v index d41c95ce3a..b289fc0ffc 100644 --- a/examples/gg/fire.v +++ b/examples/gg/fire.v @@ -59,7 +59,7 @@ fn main() { mut app := &App{ buf: [][]int{len: height - 1, init: []int{len: width}} } - app.buf << []int{len: width, init: 36} // white fire base + app.buf << [[]int{len: width, init: 36}] // white fire base app.gg = gg.new_context( event_fn: event diff --git a/vlib/v/checker/infix.v b/vlib/v/checker/infix.v index 1493278d74..00b495262e 100644 --- a/vlib/v/checker/infix.v +++ b/vlib/v/checker/infix.v @@ -71,6 +71,13 @@ fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type { } } } + } else if mut node.right is ast.ArrayInit { + if node.right.exprs.len == 0 { + // handle arr << [] where [] is empty + info := c.table.sym(left_type).array_info() + node.right.elem_type = info.elem_type + c.expected_type = info.elem_type + } } } mut right_type := c.expr(mut node.right)