Visitar URL original
fix(es/minifier): preserve pure annotation ownership by labor0-bot[bot] · Pull Request #12180 · swc-project/swc · GitHub
Skip to content

fix(es/minifier): preserve pure annotation ownership - #12180

Merged
Donny/강동윤 (kdy1) merged 3 commits into
mainfrom
fix-12177-pure-annotation-ownership
Sep 4, 2026
Merged

Donny/강동윤 (kdy1) merged 3 commits into
mainfrom
fix-12177-pure-annotation-ownership

Conversation

@labor0-bot

@labor0-bot labor0-bot Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description:

Preserve PURE annotation ownership when parenthesis removal relocates a leading comment onto an inner callee expression. The metadata pass now checks the comment's original source span before promoting it to an enclosing call, preventing observable outer invocations from being treated as pure without hard-coding individual callee shapes.

Synthetic PURE spans and legitimate whole-call annotations retain their existing behavior, including sequence-expression support. The existing protections for nested direct calls, optional calls, constructors, and tagged templates are also preserved.

Adds an executable SWC-owned regression fixture covering side-effectful function-expression and helper-call callees, removable whole-call annotations, sequence expressions, and call-like callees with compression, mangling, and module mode enabled.

Validation:

  • cargo fmt --all
  • cargo test -p swc_ecma_minifier
  • crates/swc_ecma_minifier/./scripts/test.sh
  • crates/swc_ecma_minifier/./scripts/exec.sh
  • cargo clippy -p swc_ecma_minifier --all-targets -- -D warnings

The runner could not initialize submodules because it reports that each submodule requires an independently bound repository credential. Consequently, workspace-wide Clippy could not compile the HTML parser's absent html5lib-tests fixtures; strict Clippy for the changed crate passes.

Related issue (if exists):

Closes #12177

@labor0-bot
labor0-bot Bot requested a review from a team as a code owner September 3, 2026 05:02
@changeset-bot

changeset-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a11a4b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@labor0-bot

labor0-bot Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Continue working with Labor0

Submit a formal review from Files changed, or leave an inline review comment; neither requires an @mention. To request work from Conversation, include @labor0-bot plus a meaningful instruction in the comment.

Reviews from collaborators with Write, Maintain, or Admin access are handled automatically. Ask a question for an explanation, or request a code change and Labor0 will evaluate it and update this pull request when appropriate.

Successful change requests update the branch without a routine completion reply. Labor0 replies to questions and non-actionable feedback and resolves each processed inline review thread unless clarification is required. Conversation comments have no review thread to resolve. Automated review boilerplate paired with selected inline feedback does not receive a separate reply. Related feedback may be handled together, so wait for any necessary replies, new commits, and required checks before merging.

Learn more


Labor0 task status

  • Status: Completed
  • Current work: None
  • Last updated: 2026-09-04 14:03 UTC

Open the Labor0 task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5bb82bc8d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "Codex (@codex) address that feedback".

Comment thread crates/swc_ecma_minifier/src/metadata/mod.rs
Comment thread crates/swc_ecma_minifier/src/metadata/mod.rs Outdated
@codspeed

codspeed Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 200 untouched benchmarks
⏩ 61 skipped benchmarks1


Comparing fix-12177-pure-annotation-ownership (1a11a4b) with main (a789691)

Open in CodSpeed

Footnotes

  1. 61 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@kdy1 Donny/강동윤 (kdy1) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add changeset

@labor0-bot
labor0-bot Bot requested a review from a team as a code owner September 4, 2026 13:17
@kdy1 Donny/강동윤 (kdy1) self-assigned this Sep 4, 2026
@kdy1
Donny/강동윤 (kdy1) merged commit ec780f9 into main Sep 4, 2026
67 of 68 checks passed
@kdy1
Donny/강동윤 (kdy1) deleted the fix-12177-pure-annotation-ownership branch September 4, 2026 14:03
@github-actions github-actions Bot modified the milestones: Planned, v1.16.2 Sep 4, 2026
@swc-project swc (swc-project) locked as resolved and limited conversation to collaborators Oct 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

es/minifier: side-effectful IIFE is removed when its callee carries /* @__PURE__ */

2 participants