Skip to content

🐛 fix(js): fold arithmetic over separated literals - #2529

Merged
gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/js-separator-fold
Nov 20, 2026
Merged

gaborbernat merged 1 commit into
tox-dev:mainfrom
gaborbernat:fix/js-separator-fold

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

minify_js() refused to fold integer arithmetic over literals with _ separators, but the printer drops them. 1_0+1 printed as 10+1, and minifying that output again folded it to 11, so the output did not minify to itself.

int_value now reads through separators and bounds the parsed value below 10^15 instead of bounding the lexeme length, so a separated literal folds in the same pass that prints it.

@gaborbernat gaborbernat added the bug Something isn't working label Nov 20, 2026
int_value refused a literal with _ separators, but the printer drops them,
so 1_0+1 printed as 10+1 and a second minification folded it to 11. It now
reads through the separators, bounding the value rather than the lexeme.
@gaborbernat
gaborbernat force-pushed the fix/js-separator-fold branch from 4cf8141 to 599b54e Compare November 20, 2026 14:07
@codspeed

codspeed Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 580 untouched benchmarks
⏩ 91 skipped benchmarks1


Comparing gaborbernat:fix/js-separator-fold (599b54e) with main (59a6dee)

Open in CodSpeed

Footnotes

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

@gaborbernat
gaborbernat merged commit 3d31e25 into tox-dev:main Nov 20, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant