fix(encode): keep a []any of tables in the value-array form

Assisted-by: GLM 5.3
This commit is contained in:
2026-09-17 23:10:35 +02:00
parent c485aab227
commit d5327568fb
5 changed files with 48 additions and 0 deletions
+5
View File
@@ -331,6 +331,11 @@ tree, _ := interpres.Parse([]byte(`arr = [1, {a = 2}, "x"]`))
out, _ := interpres.Marshal(tree) // arr = [1, {a = 2}, "x"]
```
A `[]any` holding only tables keeps the value-array form as well, because that
is the shape `Parse` gives a value array of inline tables; emitting it as
`[[headers]]` would re-parse as `[]map[string]any` and change the value's type
across a round-trip.
### Empty arrays
A nil slice is always omitted. An empty (length 0) array of tables is always