diff --git a/vlib/toml/parser/parser.v b/vlib/toml/parser/parser.v index 05bfe32747..3453cc3496 100644 --- a/vlib/toml/parser/parser.v +++ b/vlib/toml/parser/parser.v @@ -776,16 +776,19 @@ pub fn (mut p Parser) double_array_of_tables(mut table map[string]ast.Value) ? { // Implicit allocation if p.last_aot.len == 0 { util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'implicit allocation of array for dotted key `$dotted_key`.') - table[first.str()] = []ast.Value{} p.last_aot = first // We register this implicit allocation as *explicit* to be able to catch // special cases like: // https://github.com/BurntSushi/toml-test/blob/576db852/tests/invalid/table/array-implicit.toml p.explicit_declared << first - t_arr = &(table[p.last_aot.str()] as []ast.Value) - t_arr << ast.Value(map[string]ast.Value{}) - p.last_aot_index = t_arr.len - 1 + mut nm := map[string]ast.Value{} + nm[last.str()] = []ast.Value{} + table[first.str()] = ast.Value(nm) + + t_arr = &(nm[last.str()] as []ast.Value) + t_arr << p.array_of_tables_contents() ? + return } else { return error(@MOD + '.' + @STRUCT + '.' + @FN + ' nested array of tables key "$first" does not match "$p.last_aot". (excerpt): "...${p.excerpt()}..."') diff --git a/vlib/toml/tests/burntsushi.toml-test_test.v b/vlib/toml/tests/burntsushi.toml-test_test.v index 6bc1bd9116..80e25433d7 100644 --- a/vlib/toml/tests/burntsushi.toml-test_test.v +++ b/vlib/toml/tests/burntsushi.toml-test_test.v @@ -17,8 +17,6 @@ const ( valid_value_exceptions = [ // Integer 'integer/long.toml', // TODO awaits BUG fix with strconv.parse_int('-9223372036854775808') - // Table - 'table/array-implicit.toml', // Date-time 'datetime/milliseconds.toml', // Key