Skip to content

fix(minifier): prevent expression inlining into block-scoped for-in declarations#18651

Merged
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-minifier-inlining-issue
Jan 30, 2026
Merged

fix(minifier): prevent expression inlining into block-scoped for-in declarations#18651
graphite-app[bot] merged 1 commit intomainfrom
copilot/fix-minifier-inlining-issue

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

No description provided.

Copilot AI changed the title [WIP] Fix incorrect inlining in minifier for for-in with let minifier: prevent expression inlining into block-scoped for-in declarations Jan 28, 2026
Copilot AI requested a review from sapphi-red January 28, 2026 03:22
@github-actions github-actions bot added the A-minifier Area - Minifier label Jan 28, 2026
@sapphi-red sapphi-red changed the title minifier: prevent expression inlining into block-scoped for-in declarations fix(minifier): prevent expression inlining into block-scoped for-in declarations Jan 28, 2026
@github-actions github-actions bot added the C-bug Category - Bug label Jan 28, 2026
@sapphi-red
Copy link
Member

@copilot update tasks/track_memory_allocations/allocs_minifier.snap with cargo allocs

Copy link
Contributor Author

Copilot AI commented Jan 28, 2026

@copilot update tasks/track_memory_allocations/allocs_minifier.snap with cargo allocs

Updated allocs_minifier.snap with cargo allocs. Minor changes to arena allocations for pdf.mjs (47464 → 47462, 7730 → 7734) due to the additional condition check. Commit: 299f7c9

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/oxc-project/benchmark-files/contents
    • Triggering command: /usr/bin/curl curl --insecure -L REDACTED /ind�� /index.crates.iox86_64-linux-gnu stup/toolchains/-MD 0/x64/bin/as bf8f57aaf.seq_maas rcgu.o (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from sapphi-red January 28, 2026 04:02
@sapphi-red sapphi-red marked this pull request as ready for review January 28, 2026 04:14
Copilot AI review requested due to automatic review settings January 28, 2026 04:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a minifier correctness bug where expression statements were inlined into for-in loops with block-scoped (let/const) loop bindings, which can introduce variable shadowing and change runtime behavior.

Changes:

  • Prevent sequence inlining into for-in when the loop LHS is a non-var variable declaration.
  • Add regression tests covering let, const, var, and undeclared for-in LHS forms.
  • Update the minifier memory allocation snapshot.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
crates/oxc_minifier/src/peephole/minimize_statements.rs Adds a guard to avoid inlining into block-scoped for-in declarations to prevent shadowing bugs.
crates/oxc_minifier/tests/peephole/minimize_statements.rs Adds regression tests for let/const (no inline) and var/identifier (inline) behavior.
tasks/track_memory_allocations/allocs_minifier.snap Updates allocation snapshot reflecting the change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sapphi-red sapphi-red assigned Boshen and unassigned sapphi-red and Copilot Jan 28, 2026
@sapphi-red sapphi-red requested a review from Boshen January 28, 2026 04:25
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jan 30, 2026
Copy link
Member

Boshen commented Jan 30, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the copilot/fix-minifier-inlining-issue branch from 5aabc89 to 2e34461 Compare January 30, 2026 10:17
@graphite-app graphite-app bot merged commit 2e34461 into main Jan 30, 2026
21 checks passed
@graphite-app graphite-app bot deleted the copilot/fix-minifier-inlining-issue branch January 30, 2026 10:24
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 30, 2026
camc314 added a commit that referenced this pull request Feb 2, 2026
### 💥 BREAKING CHANGES

- 445cb1a oxc_allocator: [**BREAKING**] Remove dangerous `Allocator`
methods (#18715) (overlookmotel)

### 🚀 Features

- 8670b18 parser: Error on ambient class accessor implementations
(#18592) (camc314)

### 🐛 Bug Fixes

- 2e34461 minifier: Prevent expression inlining into block-scoped for-in
declarations (#18651) (copilot-swe-agent)

### 📚 Documentation

- 3d01fa1 transformer: Update links to use Oxc docs (#18722)
(sapphi-red)

Co-authored-by: camc314 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minifier C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments