diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 8cc0da76cd..7f94c36a75 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -542,3 +542,17 @@ fn test_for_last() { assert s == '[1, 2, 3, 4]' } */ + +struct Foo { + mut: + bar []int +} + +fn test_in_struct() { + mut baz := Foo{ + bar: [0, 0, 0] + } + baz.bar[0] += 2 + baz.bar[0]++ + assert baz.bar[0] == 3 +} diff --git a/vlib/compiler/parser.v b/vlib/compiler/parser.v index 7afd30acf4..6c54279682 100644 --- a/vlib/compiler/parser.v +++ b/vlib/compiler/parser.v @@ -1964,7 +1964,7 @@ fn (p mut Parser) var_expr(v Var) string { // p.print_tok() // dc++ if p.tok == .lsbr { - // typ = p.index_expr(typ, fn_ph, v) + typ = p.index_expr(typ, fn_ph) } } // `a++` and `a--`