From f0509c1fb90f6ba61c226deea63ad072c603ed6f Mon Sep 17 00:00:00 2001 From: Ahmir Postell Date: Tue, 29 Apr 2025 01:49:11 -0400 Subject: [PATCH 1/2] fix: infer correct type when pushing array literal --- vlib/v/checker/infix.v | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vlib/v/checker/infix.v b/vlib/v/checker/infix.v index b0df4e4b0c..62e5fe80c0 100644 --- a/vlib/v/checker/infix.v +++ b/vlib/v/checker/infix.v @@ -72,6 +72,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) From 96e9c7831f5016d20eaf6939662982be3ecda6e2 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 5 Jul 2025 12:24:07 +0300 Subject: [PATCH 2/2] fix for compiling examples/gg/fire.v --- examples/gg/fire.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gg/fire.v b/examples/gg/fire.v index a95325b748..7b8a9361ca 100644 --- a/examples/gg/fire.v +++ b/examples/gg/fire.v @@ -60,7 +60,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