Skip to content

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Nov 2, 2025

{ __proto__: null } instanceof Object should be false or kept as-is, or it was compressed to true.

@github-actions github-actions bot added A-minifier Area - Minifier C-bug Category - Bug labels Nov 2, 2025
Copy link
Member Author


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.

@sapphi-red sapphi-red requested a review from Boshen November 2, 2025 09:13
@sapphi-red sapphi-red marked this pull request as ready for review November 2, 2025 09:14
Copilot AI review requested due to automatic review settings November 2, 2025 09: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

This PR improves the constant evaluation of instanceof Object expressions in the minifier by handling more edge cases, particularly object literals with __proto__ set to null. The change fixes a test case and improves test coverage from 99.04% to 99.15%.

  • Enhanced instanceof Object evaluation to correctly handle object expressions with __proto__ modifications
  • Added test coverage for RegExp, arrow functions, function expressions, and class expressions
  • Updated snapshot to reflect improved test pass rate

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
tasks/coverage/snapshots/minifier_node_compat.snap Updated test coverage statistics showing one additional passing test
crates/oxc_minifier/src/peephole/fold_constants.rs Added test cases for various expression types with instanceof Object
crates/oxc_ecmascript/src/constant_evaluation/mod.rs Enhanced instanceof evaluation logic to handle edge cases like __proto__: null

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

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 2, 2025

CodSpeed Performance Report

Merging #15217 will not alter performance

Comparing 11-02-fix_minifier_handle___proto___null_instanceof_object_correctly (60b7c1f) with main (75c9164)

Summary

✅ 37 untouched

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Nov 2, 2025
Copy link
Member

Boshen commented Nov 2, 2025

Merge activity

…ly (#15217)

`{ __proto__: null } instanceof Object` should be `false` or kept as-is, or it was compressed to `true`.
@graphite-app graphite-app bot force-pushed the 11-02-fix_minifier_handle___proto___null_instanceof_object_correctly branch from 60b7c1f to 8b14ec9 Compare November 2, 2025 12:20
@graphite-app graphite-app bot merged commit 8b14ec9 into main Nov 2, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 11-02-fix_minifier_handle___proto___null_instanceof_object_correctly branch November 2, 2025 12:29
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 2, 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.

3 participants