Expansion step 13.11 says:
If
container mappingincludes@listandexpanded valueis not already a list object, convertexpanded valueto a list object by first setting it to an array containing onlyexpanded valueif it is not already an array, and then by setting it to a map containing the key-value pair@list-expanded value.
In test t0004 I believe the recursive Expansion call in 13.9 for the mylist1 key will set expanded value to:
[
{
"@list": []
}
]The text in 13.11 will then turn this into a new map:
{
"@list": [
{
"@list": []
}
]
}instead of the value expected by the test:
[
{
"@list": []
}
]It's not clear to me where this double-@nest structure should be simplified. It seems related to 17.2 (which simplifies @set), and possibly to 19.1 which drops maps with only @value or @list keys, but *only when active property is null or @graph (which is not the case here).
This goes back to changes in #295. I think the change to always return an array came about because there is text at the end of the 1.0 algorithm, which is missing:
This paragraph, which is run after the algorithm, so is not part of the recursive algorithm, got rolled into steps 20-22. We should probably revert the change from #295 which moved these up, and go back to the 1.0 description, so that when the expansion algorithm is passed an object, it typically returns an object, and not an array. We can re-examine some of the other changes that came as a consequence of this.