Skip to content

Fix enum exponentiation folding at the int64 boundary - #65716

Draft
Anders Hejlsberg (ahejlsberg) wants to merge 4 commits into
mainfrom
copilot/fix-negative-value-enum
Draft

Anders Hejlsberg (ahejlsberg) wants to merge 4 commits into
mainfrom
copilot/fix-negative-value-enum

Conversation

@ahejlsberg

@ahejlsberg Anders Hejlsberg (ahejlsberg) commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

TypeScript 7 can fold (2 ** 63) ** 3 in an enum to a negative value because the positive base is converted to an out-of-range int64.

  • Fix: Exclude 2 ** 63 from the exact-integer exponentiation path; preserve -2 ** 63 as a valid endpoint.
  • Coverage: Add boundary cases for odd and even exponents, negative bases, and enum JavaScript and declaration emit.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@ahejlsberg Anders Hejlsberg (ahejlsberg) changed the title [WIP] Fix enum folding to correct positive values in TypeScript 7 Fix enum exponentiation folding at the int64 boundary Nov 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS 7 folds (2 ** 63) ** 3 in an enum to a negative value

2 participants