You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: make array operator[] dense when assigning past the end (#1611) (#1693)
* fix: make array operator[] dense when assigning past the end (#1611)
Value::operator[](ArrayIndex) only inserted the requested index, so
`arr[5] = x` on an empty array stored a single element while size()
reported 6 (highest index + 1) and serialization emitted six elements
(missing indices written as null). Range-for iteration walked the
underlying sparse map and therefore visited only the one populated
element -- inconsistent with both size() and the serialized output.
JSON arrays are dense, so materialize the intervening indices as null
when assigning beyond the current end, exactly as resize() already does
when growing. Iteration, size(), equality, and serialization now agree.
Note: this is a behavior change (arrays are now dense in memory after a
sparse-looking assignment), so it targets the 1.10.0 minor release rather
than a 1.9.x patch. It is ABI-compatible (no signature or layout change),
so SOVERSION is unchanged.
* chore: bump version to 1.10.0
master becomes the 1.10 line. The #1611 array fix changes runtime
behavior (dense arrays) for existing valid code, so the next release is
a minor bump, not a 1.9.x patch. SOVERSION stays at 27 (ABI unchanged).
0 commit comments