Skip to content

fix(js/ts): int64 non-decimal parsing and BitConverter .NET mismatches#4748

Open
Thorium wants to merge 1 commit into
fable-compiler:mainfrom
Thorium:fix-int64-parse-bitconverter
Open

fix(js/ts): int64 non-decimal parsing and BitConverter .NET mismatches#4748
Thorium wants to merge 1 commit into
fable-compiler:mainfrom
Thorium:fix-int64-parse-bitconverter

Conversation

@Thorium

@Thorium Thorium commented Jul 8, 2026

Copy link
Copy Markdown
Contributor
  • Long.parse never applied two's-complement wrap for hex/octal/binary, returning values outside the int64 range (0xFFFFFFFFFFFFFFFF parsed to 2^64-1 instead of -1); now mirrors Int32's sign-extension via BigInt.asIntN with proper range checks
  • parse crashed with a raw JS error on negative prefixed input like -0xFF (valid .NET input, expect -255)
  • BitConverter.toBoolean returned true only for byte 1; .NET treats any nonzero byte as true
  • BitConverter.toString emitted lowercase hex; .NET is uppercase

(split from #4738)

- Long.parse never applied two's-complement wrap for hex/octal/binary,
  returning values outside the int64 range (0xFFFFFFFFFFFFFFFF parsed
  to 2^64-1 instead of -1); now mirrors Int32's sign-extension via
  BigInt.asIntN with proper range checks
- parse crashed with a raw JS error on negative prefixed input
  like -0xFF (valid .NET input, expect -255)
- BitConverter.toBoolean returned true only for byte 1; .NET treats
  any nonzero byte as true
- BitConverter.toString emitted lowercase hex; .NET is uppercase
@dbrattli dbrattli changed the title fix: int64 non-decimal parsing and BitConverter .NET mismatches fix(js/ts): int64 non-decimal parsing and BitConverter .NET mismatches Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant