Revert "feat: improve function return value tracking (#6065)" - #6490
Conversation
This reverts commit 456b237.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
cc @cyyynthia |
Performance report
|
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#revert-6065Notice: Ensure you have installed the latest nightly Rust toolchain. If you haven't installed it yet, please see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust. or load it into the REPL: |
There was a problem hiding this comment.
Pull request overview
This PR reverts the changes introduced by #6065 (“improve function return value tracking”) to mitigate suspected regressions in Rollup 4.63.0 related to tree-shaking behavior and performance (issues #6488, #6487).
Changes:
- Removes/reverts return-value/literal-tracking logic (e.g.,
MultiExpressionbehavior and implicit/unknown return handling) to reduce aggressive optimization decisions. - Deletes the test fixtures that were added specifically to validate the reverted behavior.
- Refactors internal “unassigned” sentinels to local symbols and adjusts several AST node implementations accordingly.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/form/samples/pure-comment-scenarios-complex/main.js | Updates PURE comment scenario sample to match reverted behavior. |
| test/form/samples/pure-comment-scenarios-complex/_expected.js | Updates expected output for PURE comment scenario after revert. |
| test/form/samples/object-expression/proto-property/main.js | Simplifies proto-property sample (removes extra getter/use cases) to match reverted semantics. |
| test/form/samples/object-expression/proto-property/_expected.js | Updates expected output for proto-property sample. |
| test/form/samples/literals-from-return-expressions-perf/main.js | Removes perf-focused return-expression tracking fixture (revert cleanup). |
| test/form/samples/literals-from-return-expressions-perf/_expected.js | Removes expected output for deleted perf fixture. |
| test/form/samples/literals-from-return-expressions-perf/_config.js | Removes config for deleted perf fixture. |
| test/form/samples/literals-from-return-expressions-deopt/main.js | Removes deopt-focused return-expression tracking fixture (revert cleanup). |
| test/form/samples/literals-from-return-expressions-deopt/_expected.js | Removes expected output for deleted deopt fixture. |
| test/form/samples/literals-from-return-expressions-deopt/_config.js | Removes config for deleted deopt fixture. |
| test/form/samples/literals-from-return-expressions-branches/main.js | Removes branches-focused return-expression tracking fixture (revert cleanup). |
| test/form/samples/literals-from-return-expressions-branches/_expected.js | Removes expected output for deleted branches fixture. |
| test/form/samples/literals-from-return-expressions-branches/_config.js | Removes config for deleted branches fixture. |
| src/utils/unassigned.ts | Removes shared UNASSIGNED sentinel module. |
| src/ast/values.ts | Reworks UNDEFINED_EXPRESSION and member-description defaults as part of the revert. |
| src/ast/scopes/ReturnValueScope.ts | Reverts multi-return handling to avoid MultiExpression aggregation and forces deopts when multiple return paths exist. |
| src/ast/nodes/UnaryExpression.ts | Switches to a local UNASSIGNED sentinel symbol after removing src/utils/unassigned.ts. |
| src/ast/nodes/shared/ObjectEntity.ts | Removes comment references to deleted return-expression tracking fixtures. |
| src/ast/nodes/shared/MultiExpression.ts | Reverts MultiExpression to a simpler propagation model (no literal merging / treeshaken awareness). |
| src/ast/nodes/shared/Expression.ts | Removes LiteralExpression and adjusts UNKNOWN_EXPRESSION representation. |
| src/ast/nodes/shared/CallExpressionBase.ts | Adjusts call-expression cache deopt behavior (but currently introduces a runtime bug). |
| src/ast/nodes/ReturnStatement.ts | Removes return-statement deoptimization tracking and uses doNotDeoptimize hook. |
| src/ast/nodes/MemberExpression.ts | Minor include-path adjustment for optional variable handling. |
| src/ast/nodes/Literal.ts | Adjusts members field mutability typing. |
| src/ast/nodes/IfStatement.ts | Replaces shared UNASSIGNED sentinel usage with local symbol + unknown caching behavior. |
| src/ast/nodes/CallExpression.ts | Replaces prototype include override with an explicit includeNode implementation. |
| src/ast/nodes/BlockStatement.ts | Removes “virtual return statement” construction; directly records an unknown return in scope. |
| src/ast/nodes/BinaryExpression.ts | Switches to a local UNASSIGNED sentinel symbol after removing src/utils/unassigned.ts. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6490 +/- ##
==========================================
+ Coverage 98.76% 98.78% +0.01%
==========================================
Files 276 275 -1
Lines 10885 10823 -62
Branches 2908 2887 -21
==========================================
- Hits 10751 10691 -60
+ Misses 91 89 -2
Partials 43 43 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This reverts commit 456b237.
|
This PR has been released as part of rollup@4.63.1. You can test it via |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
Considering the unknown nature of #6488 and #6487, this reverts #6065 for now until the issue is better understood.