Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Aug 9, 2025

No description provided.

Copilot AI review requested due to automatic review settings August 9, 2025 15:13
Copy link
Member Author

Boshen commented Aug 9, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-minifier Area - Minifier C-bug Category - Bug labels Aug 9, 2025
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

This PR improves the minifier's constant evaluation for conditional expressions by enhancing the logic that converts patterns like a ? true : false to !!a and a ? false : true to !a. Instead of only matching literal boolean values, the updated code now evaluates expressions that resolve to boolean values.

  • Moved and enhanced the conditional expression optimization logic to evaluate expressions that can be reduced to boolean values
  • Added constant evaluation capability to handle more complex expressions that resolve to true/false
  • Added comprehensive test cases to verify the enhanced boolean evaluation logic

Reviewed Changes

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

File Description
crates/oxc_minifier/src/peephole/minimize_conditional_expression.rs Enhanced conditional expression optimization to use constant evaluation instead of literal matching
crates/oxc_minifier/src/peephole/fold_constants.rs Added test cases for the improved boolean evaluation logic

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 9, 2025

CodSpeed Instrumentation Performance Report

Merging #12940 will not alter performance

Comparing 08-09-fix_minifier_evaluate_e_consequent_alternate_ (ad4aeaf) with main (d7e1ddb)

Summary

✅ 34 untouched benchmarks

@Boshen Boshen force-pushed the 08-09-fix_minifier_evaluate_e_consequent_alternate_ branch from 3143f7c to a5881e9 Compare August 9, 2025 15:52
@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 9, 2025
Copy link
Member Author

Boshen commented Aug 9, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 08-09-fix_minifier_evaluate_e_consequent_alternate_ branch from a5881e9 to ad4aeaf Compare August 9, 2025 16:06
@graphite-app graphite-app bot merged commit ad4aeaf into main Aug 9, 2025
30 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 9, 2025
@graphite-app graphite-app bot deleted the 08-09-fix_minifier_evaluate_e_consequent_alternate_ branch August 9, 2025 16:12
taearls pushed a commit to taearls/oxc that referenced this pull request Aug 12, 2025
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.

2 participants