Repository navigation
bigint: range checks and exact **; namespace retry generated functions twice - #728
Merged
Merged
Conversation
…ed functions twice - A bigint divided by 0n (a hardware fault) or raised to a negative power (1n) stops the program with TypeScript's RangeError message, as an invalid array length does (#483). - `**` of two bigints is an integer power by squaring in the lowering: through math.powf `2n ** 62n` was rounded. - A namespace whose function names a class declared after it is retried once the class is there: the retry cleared which of its statements were generated, so the ones the first try had made were generated again ("redefinition of symbol"). The real pass keeps them; a dummy run still clears them all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
x / 0nandx % 0nwere a hardware fault, andx ** -1ngave1n. Both now stop the program with TypeScript's RangeError message ("Division by zero", "Exponent must be non-negative"), as an invalid array length does (Array length is unchecked: a negative or huge length= crashes or gives a wrong length, and failed allocations are not detected #483).**: an integer**is lowered to exponentiation by squaring; throughmath.powf,2n ** 62nwas rounded.The DefaultLib side (
Number.toStringreturning nothing, and radix conversion) is in the companion DefaultLib PR; the two are independent.Tests
00bigint_ops.ts: powers past 2^53,(-3n) ** 3n,**=bigint-range/{division,remainder,power}.ts× gc/rc/none/own: the message after the output printed before it00namespace_forward_class.ts🤖 Generated with Claude Code