Skip to content

Comments

fix(es/minifier): Handle undefined args#11573

Closed
cuyl wants to merge 14 commits intoswc-project:mainfrom
cuyl:handle-undefined-args
Closed

fix(es/minifier): Handle undefined args#11573
cuyl wants to merge 14 commits intoswc-project:mainfrom
cuyl:handle-undefined-args

Conversation

@cuyl
Copy link
Contributor

@cuyl cuyl commented Feb 21, 2026

  • Evaluate when parameters is empty or undefined.

Closes #11572

@cuyl cuyl requested a review from a team as a code owner February 21, 2026 16:47
@changeset-bot
Copy link

changeset-bot bot commented Feb 21, 2026

⚠️ No Changeset found

Latest commit: 29f8cb9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

Copy link

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

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: bb2ce82174

ℹ️ 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 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 address that feedback".

@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

Binary Sizes

File Size
swc.linux-x64-gnu.node 28M (28587208 bytes)

Commit: 1ccae49

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 21, 2026

Merging this PR will not alter performance

✅ 184 untouched benchmarks


Comparing cuyl:handle-undefined-args (29f8cb9) with main (de2a348)

Open in CodSpeed

@cuyl cuyl force-pushed the handle-undefined-args branch from bb2ce82 to 343441c Compare February 21, 2026 17:25
Copy link

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

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: 343441c09d

ℹ️ 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 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 address that feedback".

@cuyl cuyl force-pushed the handle-undefined-args branch from 69b875e to 2ef47dc Compare February 22, 2026 01:18
Copy link

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

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: 2ef47dcbea

ℹ️ 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 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 address that feedback".

@cuyl
Copy link
Contributor Author

cuyl commented Feb 22, 2026

P2 Badge Preserve trailing-argument exceptions in undefined fast path

This toPrecision(undefined) fast path folds the call even when additional arguments are present, but the precheck only filters may_have_side_effects and misses some expressions that throw without side effects. For example, (1.23).toPrecision(undefined, 1n + 1) must throw a TypeError while evaluating the second argument, yet this branch rewrites the whole call to a string literal and suppresses that runtime error. This regression is introduced by the new undefined-argument folding condition.

Useful? React with 👍 / 👎.

These edge cases are exist issue.
We have to refactor fn may_have_side_effects to handle more edge cases.
But I found 100+ use cases in other files.
It may have too much impact, maybe we can do it in another PR.
@kdy1

@cuyl cuyl requested a review from kdy1 February 22, 2026 02:08
@kdy1
Copy link
Member

kdy1 commented Feb 22, 2026

You can do it in another PR, but it should be merged before this PR

@cuyl
Copy link
Contributor Author

cuyl commented Feb 22, 2026

I'll do it when I have time.

@kdy1 kdy1 marked this pull request as draft February 23, 2026 03:13
@cuyl cuyl force-pushed the handle-undefined-args branch from 2ef47dc to b7b7ee3 Compare February 23, 2026 06:57
@cuyl cuyl force-pushed the handle-undefined-args branch from b7b7ee3 to 0230bf6 Compare February 23, 2026 07:27
@cuyl cuyl marked this pull request as ready for review February 23, 2026 07:27
Copy link

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

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: 0230bf61cb

ℹ️ 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 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 address that feedback".

Copy link

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

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: e31f3d451a

ℹ️ 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 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 address that feedback".

@cuyl cuyl marked this pull request as draft February 23, 2026 08:37
@cuyl cuyl force-pushed the handle-undefined-args branch from e31f3d4 to 2ce465e Compare February 23, 2026 10:03
@cuyl cuyl force-pushed the handle-undefined-args branch from 2ce465e to b05433d Compare February 23, 2026 10:26
@cuyl cuyl marked this pull request as ready for review February 23, 2026 10:27
Copy link

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

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: b05433d41a

ℹ️ 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 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 address that feedback".

@cuyl cuyl requested a review from a team as a code owner February 23, 2026 11:40
@socket-security
Copy link

socket-security bot commented Feb 23, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Copy link

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

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: faa512fd65

ℹ️ 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 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 address that feedback".

@cuyl
Copy link
Contributor Author

cuyl commented Feb 23, 2026

@codex review

Copy link

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

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: faa512fd65

ℹ️ 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 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 address that feedback".

@cuyl
Copy link
Contributor Author

cuyl commented Feb 23, 2026

@codex review

Copy link

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

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: 6ea2e94b6c

ℹ️ 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 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 address that feedback".

@cuyl
Copy link
Contributor Author

cuyl commented Feb 23, 2026

@codex review

Copy link

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

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: da63d688ae

ℹ️ 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 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 address that feedback".

Copy link

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

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: 1d367bfc3b

ℹ️ 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 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 address that feedback".

Copy link

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

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: 5e2f3cd30e

ℹ️ 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 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 address that feedback".

Copy link

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

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: 50958934b4

ℹ️ 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 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 address that feedback".

Copy link

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

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: 5f05d14387

ℹ️ 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 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 address that feedback".

@cuyl cuyl force-pushed the handle-undefined-args branch 2 times, most recently from 2b265de to b9bacc8 Compare February 24, 2026 06:30
@cuyl cuyl force-pushed the handle-undefined-args branch from b9bacc8 to 29f8cb9 Compare February 24, 2026 06:38
@cuyl
Copy link
Contributor Author

cuyl commented Feb 24, 2026

This PR’s scope has expanded significantly beyond the original issue. I’ve realized that fully addressing may_have_side_effects is an endless task without a full runtime. So I’ve reverted those specific changes. I have kept the new test cases to document the behavior for future work.

Since this is a pre-existing issue not introduced by this PR, I don't think it blocks this PR.

@kdy1

@cuyl
Copy link
Contributor Author

cuyl commented Feb 24, 2026

We have a wrong ouput on 1.23.toExponential(undefined), I believe fixing this regression is also a high priority issue.

@cuyl
Copy link
Contributor Author

cuyl commented Feb 24, 2026

@codex review

@kdy1
Copy link
Member

kdy1 commented Feb 24, 2026

Can we fix the correctness issue of toPrecision first, with another PR?

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Breezy!

ℹ️ 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 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 address that feedback".

@cuyl
Copy link
Contributor Author

cuyl commented Feb 24, 2026

Ok, I will close this PR and open another.
@kdy1

@cuyl cuyl closed this Feb 24, 2026
@github-actions github-actions bot added this to the Planned milestone Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Should treat undefined the same as empty args when calling toExponential and toPrecision

2 participants