Latest Results
fix(es/minifier): Do not merge sequences across array spreads (#12375)
**Description:**
With `collapse_vars`, a declaration is merged into a later expression
only if everything evaluated before the use is skippable.
`is_skippable_for_seq` checked array literal elements one by one, so
`[...mutable]` was treated like a plain read of the `mutable` binding.
The binding is never reassigned, so the check passed, but spreading
reads the array's contents, which the moved initializer can change. In
the reported case `data.map((x) => f(x))` pushes into `mutable` through
`f`, and after the merge the spread ran first and produced an empty
array.
It only showed up with `keep_fnames` because without it `f` is inlined
into the arrow, so `mutable` appears in the initializer and the existing
check already blocks the merge.
Array spreads are now treated as not skippable, the same way the object
literal branch already handles spread properties.
`merge_sequential_expr` also walks array elements and call, `super` and
`new` arguments directly, so it now stops at spread elements there as
well; otherwise `return [...mutable, processed]` and
`Array.of(...mutable, processed)` were still miscompiled.
Added `tests/fixture/issues/12282` (object literal, from the issue),
`12282/array` (direct array literal) and `12282/call` (call and `new`
arguments), each with an `expected.stdout`. Each fixture fails without
its part of the change. Without the change the fixture fails with `{
mutable: [], processed: [ 2, 3, 4 ] }`; with it the output matches. All
`swc_ecma_minifier` tests pass (compress, exec, terser_exec, mangle,
size, eval, format and unit tests), and no existing fixture outputs
changed.
**Related issue (if exists):**
Closes #12282 Latest Branches
0%
kurovskyiii:fix/sync-file-bindings-return-an-error 0%
0%
© 2026 CodSpeed Technology