Skip to content

fix(minifier): add missing negation for boolean literal - #26847

Merged
Dunqing merged 2 commits into
oxc-project:mainfrom
armano2:fix/add-missing-negation-for-boolean-literal
Sep 21, 2026
Merged

Dunqing merged 2 commits into
oxc-project:mainfrom
armano2:fix/add-missing-negation-for-boolean-literal

Conversation

@armano2

@armano2 armano2 commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

we sometimes do construct BooleanLiteral, mostly in dce mode, with this we can negate its value instead of first wrapping it with not and afterwards flipping it

in dce instead of:
true -> !true
true -> false

And in non dce
true -> !true -> !!0 -> !1
true -> false -> !1

@armano2
armano2 requested a review from Dunqing as a code owner September 19, 2026 16:51
@github-actions github-actions Bot added the A-minifier Area - Minification, compression and name mangling, oxc_minifier / oxc_mangler label Sep 19, 2026
@armano2 armano2 changed the title fix: add missing negation for boolean literal fix(minifier): add missing negation for boolean literal Sep 19, 2026
@codspeed

codspeed Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 77 untouched benchmarks
⏩ 19 skipped benchmarks1


Comparing armano2:fix/add-missing-negation-for-boolean-literal (3bb4505) with main (c55ae7d)

Open in CodSpeed

Footnotes

  1. 19 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. ↩

@armano2
armano2 force-pushed the fix/add-missing-negation-for-boolean-literal branch from 77b0320 to 478f5e6 Compare September 20, 2026 19:19
@Dunqing
Dunqing force-pushed the fix/add-missing-negation-for-boolean-literal branch from 478f5e6 to f09e553 Compare September 21, 2026 03:39
@Dunqing
Dunqing force-pushed the fix/add-missing-negation-for-boolean-literal branch from f09e553 to 3bb4505 Compare September 21, 2026 03:49

@Dunqing Dunqing 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.

Nice

@Dunqing
Dunqing merged commit cd7228f into oxc-project:main Sep 21, 2026
39 checks passed
@armano2
armano2 deleted the fix/add-missing-negation-for-boolean-literal branch September 21, 2026 08:40
graphite-app Bot pushed a commit that referenced this pull request Sep 21, 2026
### 🚀 Features

- 1fac655 coverage: Support new TypeScript fixture layout (#26226) (camc314)

### 🐛 Bug Fixes

- cd7228f minifier: Add missing negation for boolean literal (#26847) (Armano)
- 32305e2 transformer: Skip enum reverse mappings for syntactic string initializers (#26724) (Dunqing)
- 7811f0a parser: Preserve reparsed `await` tokens (#26619) (camc314)
- 9220158 transformer: Skip recovered using loop patterns (#26722) (camc314)
- 3130405 parser: Recover await using object binding patterns (#26721) (camc314)
- 827fdbd parser: Reject invalid modifiers on import aliases (#26622) (camc314)

### ⚡ Performance

- 3f1e3aa minifier: Preallocate stmts vec size to avoid excesive reallocs (#26856) (Armano)
- bd3f69e semantic: Reuse identifier hashes in enum member lookups (#26773) (camc314)
- 5f72954 minifier: Reduce allocations when processing if statements (#26666) (Armano)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-minifier Area - Minification, compression and name mangling, oxc_minifier / oxc_mangler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants