diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 3d6a9762c3..ecd721bde7 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -1305,3 +1305,8 @@ fn test_array_of_map_insert() { println(x) assert '$x' == "[{}, {}, {'123': 123}, {}]" } + +fn test_multi_fixed_array_init() { + a := [3][3]int{} + assert '$a' == '[[0, 0, 0], [0, 0, 0], [0, 0, 0]]' +} diff --git a/vlib/v/parser/containers.v b/vlib/v/parser/containers.v index 20af0c877b..716f698d0e 100644 --- a/vlib/v/parser/containers.v +++ b/vlib/v/parser/containers.v @@ -54,7 +54,7 @@ fn (mut p Parser) array_init() ast.ArrayInit { } last_pos = p.tok.position() p.check(.rsbr) - if exprs.len == 1 && p.tok.kind in [.name, .amp] && p.tok.line_nr == line_nr { + if exprs.len == 1 && p.tok.kind in [.name, .amp, .lsbr] && p.tok.line_nr == line_nr { // [100]byte elem_type = p.parse_type() is_fixed = true