This commit is contained in:
Ahmir Postell 2025-09-13 09:17:38 +00:00 committed by GitHub
commit 98cbb1c94b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -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)