Skip to content

fix(parser): improve radix literal rounding - #18445

Merged
nicolo-ribaudo merged 3 commits into
7.xfrom
automation/backport-18420
Oct 29, 2026
Merged

nicolo-ribaudo merged 3 commits into
7.xfrom
automation/backport-18420

Conversation

@babel-bot

Copy link
Copy Markdown
Collaborator

Backport of #18420 to 7.x

Cherry-picked commits:

Conflicts: Resolved.

  • packages/babel-parser/src/tokenizer/index.ts: 7.x additionally has decimal (m suffix) support and isBigInt/hasExponent handling. I kept the decimal logic and applied the new readLiteralInt fast path. The fast path is skipped for decimals, and str is sliced up to end (before the n/m suffix).
  • packages/babel-parser/typings/babel-parser.d.ts: the file is structured differently on 7.x. The original change (removing InvalidNumber) was already reflected there, so I kept the 7.x version.

Fix commit:

  • Fix bigint radix fixture output after backporting #18420: on 7.x, extra.rawValue of a BigIntLiteral is a string rather than a bigint. The fixture valid-bigint-radix-above-max-safe-integer therefore used output.json instead of output.extended.json, and I regenerated it.

Checks:

  • Rebuild: passed.
  • Lint: the full make lint-ci check-compat-data could not complete in this environment (ESLint ran out of memory, and cloning compat-table failed on a certificate error). ESLint and Prettier on the changed tokenizer file passed.
  • Test: full suite passed except babel-code-frame/test/color-detection.js and babel-core/test/errors-stacks.js. These failures are unrelated to this change (terminal color detection and error stacks) and were not fixed.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 🔙 Backport to 7.x for #18420 · copilot · auto · 44.8 AIC · ⌖ 0.673 AIC · ⊞ 9.1K · ◷

JLHwung and others added 2 commits October 29, 2026 14:49
On 7.x, BigIntLiteral extra.rawValue is a string rather than a bigint.
@babel-bot babel-bot added 7.x: backport PR: Bug Fix 🐛 A type of pull request used for our changelog categories pkg: parser labels Oct 29, 2026
@babel-bot

babel-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/62688

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

commit: ab1cb3a

@JLHwung
JLHwung force-pushed the automation/backport-18420 branch from d553e41 to ab1cb3a Compare October 29, 2026 15:27
@nicolo-ribaudo
nicolo-ribaudo merged commit 3cfe35e into 7.x Oct 29, 2026
118 checks passed
@nicolo-ribaudo
nicolo-ribaudo deleted the automation/backport-18420 branch October 29, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.x: backport pkg: parser PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants