Repository navigation
Conversation
This was referenced Oct 12, 2026
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
This was referenced Oct 12, 2026
Merged
Member
Author
Dunqing
force-pushed
the
jsstr-estree-escape-table
branch
from
October 13, 2026 02:43
1df4354 to
e6324f1
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
from
October 13, 2026 02:43
bf216fc to
4bbcbcd
Compare
Dunqing
force-pushed
the
jsstr-estree-escape-table
branch
from
October 13, 2026 04:03
e6324f1 to
4e7ef41
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
from
October 13, 2026 04:03
4bbcbcd to
f32da5f
Compare
overlookmotel
force-pushed
the
claude/concat-evaluation-order
branch
from
October 14, 2026 00:21
f32da5f to
b0e0a40
Compare
overlookmotel
force-pushed
the
jsstr-estree-escape-table
branch
from
October 14, 2026 00:21
4e7ef41 to
70e565c
Compare
overlookmotel
force-pushed
the
claude/concat-evaluation-order
branch
from
October 14, 2026 00:59
b0e0a40 to
1377cca
Compare
overlookmotel
force-pushed
the
jsstr-estree-escape-table
branch
from
October 14, 2026 00:59
70e565c to
13692bf
Compare
graphite-app
Bot
force-pushed
the
jsstr-estree-escape-table
branch
from
October 14, 2026 01:20
13692bf to
404197d
Compare
graphite-app
Bot
force-pushed
the
claude/concat-evaluation-order
branch
from
October 14, 2026 01:21
1377cca to
46e2788
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
from
October 15, 2026 02:22
46e2788 to
9b9b9b2
Compare
Dunqing
force-pushed
the
jsstr-estree-escape-table
branch
from
October 15, 2026 02:22
404197d to
0db022b
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
from
October 15, 2026 02:30
9b9b9b2 to
850f799
Compare
Dunqing
pushed a commit
to rolldown/rolldown
that referenced
this pull request
Oct 16, 2026
Moves the oxc patch from main (d2bea210) to the top of the open #26242 stack (850f799a): #26712, #26716, #26717, #27096, #27098, #26743, #27580. Only #27098 breaks Rolldown: oxc's `ConstantValue::String` now holds `JSStr<'a>`. Rolldown keeps constants across modules as `String`, so: - `ConstantValue::from_oxc` replaces the `From` impl and declines a string constant with a lone surrogate (it is not inlined across modules). - `as_oxc_value` lends the string to oxc without copying, and `to_oxc_value_in` copies it into the arena where the context outlives the constant map. `StmtEvalAnalyzer` now implements `GlobalContext<'a>` for its own lifetime so it can lend. No snapshot changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSQFCN5EbczjosUMZeBc2E
Dunqing
force-pushed
the
jsstr-estree-escape-table
branch
from
October 16, 2026 04:30
0db022b to
d776cf3
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
from
October 16, 2026 04:30
850f799 to
80c6f42
Compare
Dunqing
force-pushed
the
jsstr-estree-escape-table
branch
from
October 16, 2026 04:49
d776cf3 to
279fd1a
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
from
October 16, 2026 04:49
80c6f42 to
2a17adf
Compare
Dunqing
pushed a commit
to rolldown/rolldown
that referenced
this pull request
Oct 16, 2026
Moves the oxc patch to the rebased stack top (2a17adf1, on main@6fe4c1b9). #26716, #26717 and #27098 were rewritten (#26717 no longer adds `JSStr::to_string_lossy`); the APIs Rolldown uses are unchanged, so no source changes are needed and there are no snapshot changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSQFCN5EbczjosUMZeBc2E
Dunqing
force-pushed
the
jsstr-estree-escape-table
branch
from
October 19, 2026 03:27
279fd1a to
25a719d
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
from
October 19, 2026 03:27
2a17adf to
1858bfc
Compare
Dunqing
force-pushed
the
jsstr-estree-escape-table
branch
from
October 19, 2026 08:20
25a719d to
d079749
Compare
Dunqing
force-pushed
the
claude/concat-evaluation-order
branch
2 times, most recently
from
October 19, 2026 08:23
93f60ed to
d6f6d68
Compare
graphite-app
Bot
force-pushed
the
jsstr-estree-escape-table
branch
from
October 19, 2026 08:52
d079749 to
fece563
Compare
A `concat` call evaluates every argument before it reads any: `String.prototype.concat`
coerces them to strings, and `Array.prototype.concat` reads their elements. A template literal
reads each substitution before evaluating the next, and a chain of `concat` calls reads each
call's arguments before evaluating the next call's. Folding `"".concat(arr, arr.pop())` to
`` `${arr}${arr.pop()}` `` therefore coerced `arr` before `pop` ran, and merging
`[].concat(arr).concat(arr.pop())` into one call read `arr` after it.
Coercion and these reads are pure by assumption, so the orders differ only when an argument with
side effects follows one that is read. Fold a call to a template only when no such argument
follows within it, and merge a chain only when no call has side effects after an earlier call's
read. Literals and other primitives read no state, and neither do array literals passed to
`Array.prototype.concat`. A spread counts as both a side effect and a read. Property writes count
as side effects even with `propertyWriteSideEffects: false`, which only rules out setters.
A chain whose calls each satisfy the template rule reads arguments in the same order as a
template literal, so it folds directly to one even where merging the calls would not:
`"".concat(a, " ").concat(b())` becomes `` `${a} ${b()}` ``. This keeps the shape that Babel and
TypeScript emit for template literals foldable. The rule is documented in ASSUMPTIONS.md, and
runtime tests in `napi/minify` cover both orders.
Unresolved globals count as possible side effects (a global getter could run), so
`''.concat(a, b)` with undeclared `a` and `b` is no longer folded.
Based on #26743. Part of #26242.
Implemented with AI assistance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0123ytJDyebxiELUzaFc1nwd
graphite-app
Bot
force-pushed
the
claude/concat-evaluation-order
branch
from
October 19, 2026 08:53
d6f6d68 to
d0b39df
Compare
Dunqing
added a commit
to rolldown/rolldown
that referenced
this pull request
Oct 20, 2026
Moves the oxc patch from main (d2bea210) to the top of the open #26242 stack (850f799a): #26712, #26716, #26717, #27096, #27098, #26743, #27580. Only #27098 breaks Rolldown: oxc's `ConstantValue::String` now holds `JSStr<'a>`. Rolldown keeps constants across modules as `String`, so: - `ConstantValue::from_oxc` replaces the `From` impl and declines a string constant with a lone surrogate (it is not inlined across modules). - `as_oxc_value` lends the string to oxc without copying, and `to_oxc_value_in` copies it into the arena where the context outlives the constant map. `StmtEvalAnalyzer` now implements `GlobalContext<'a>` for its own lifetime so it can lend. No snapshot changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSQFCN5EbczjosUMZeBc2E
Dunqing
added a commit
to rolldown/rolldown
that referenced
this pull request
Oct 20, 2026
Moves the oxc patch to the rebased stack top (2a17adf1, on main@6fe4c1b9). #26716, #26717 and #27098 were rewritten (#26717 no longer adds `JSStr::to_string_lossy`); the APIs Rolldown uses are unchanged, so no source changes are needed and there are no snapshot changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KSQFCN5EbczjosUMZeBc2E
graphite-app Bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
#28261) Each call in an array `concat` chain reads its arguments before the next call evaluates its own. Merging the calls moves those reads later, so a later argument can change an earlier one first: ```js function f(arr) { return [].concat(arr).concat(arr.pop()); } ``` With `arr = [1, 2, 3]` this returns `[1, 2, 3, 3]`, but main merges it into `[].concat(arr, arr.pop())`, which returns `[1, 2, 3]`. A chain now merges only when no later call has an argument with side effects after an earlier call has an argument that `concat` may read. Primitives and array literals don't count as reads. This is the array half of #27580; the string half landed in #27098. When the merge is refused, the innermost call still folds its leading literals into its array: `[1].concat(1, arr).concat(arr.pop())` → `[1, 1].concat(arr).concat(arr.pop())`. ## Size `echarts.js` grows by 8 B minified and 6 B gzipped; nothing else in `minsize` changes. The chain `[].concat(ecIns._componentsViews).concat(ecIns._chartsViews)` no longer merges, because with the default `propertyReadSideEffects` a getter on `_chartsViews` could change `_componentsViews`. With `propertyReadSideEffects: false` it merges as before. monitor-oxc: 48 files larger (+960 B raw, +76 B gzip), 8 B per `concat` call that no longer merges. ## Not covered With `propertyWriteSideEffects: false`, `arr[0] = 9` counts as free of side effects, so `[].concat(arr).concat(arr[0] = 9)` still merges. The string guard has the same gap; it needs a separate fix. Part of #26242. Implemented with AI assistance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018ogydZW3PPvmx3orpBQot4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

A
concatcall evaluates all its arguments before it reads any, but a template literal reads each substitution before evaluating the next. The minifier ignored the difference:With
arr = [1, 2, 3],freturns"1,23"andgreturns[1, 2, 3, 3]. On main they minify to`${arr}${arr.pop()}`and[].concat(arr, arr.pop()), which return"1,2,33"and[1, 2, 3].Now a call folds into a template only when no argument with side effects follows one that is read, and a chain merges only when no call has side effects after an earlier call's read. Primitives and array literals passed to
Array.prototype.concatdon't count as reads, and property writes count as side effects even withpropertyWriteSideEffects: false. Chains that pass call by call still fold straight to a template, so the"".concat(a, " ").concat(b)output of Babel and TypeScript stays foldable. The assumption is documented inASSUMPTIONS.md.Notes
''.concat(a, b)with undeclaredaandbis no longer folded.Closes #26053. Based on #26743. Part of #26242.
Implemented with AI assistance.