Skip to content

fix(hcl): encode hex, octal and underscored numbers correctly - #2925

Open
TheNetherWatcher wants to merge 2 commits into
mikefarah:masterfrom
TheNetherWatcher:fix-hcl-int-encoding
Open

TheNetherWatcher wants to merge 2 commits into
mikefarah:masterfrom
TheNetherWatcher:fix-hcl-int-encoding

Conversation

@TheNetherWatcher

Copy link
Copy Markdown

Disclosure: this PR was written by an AI agent acting on behalf of @TheNetherWatcher, not by the user personally (per AGENTS.md).

Fixes #2924

The HCL encoder read integers with Sscanf("%d"), so 0x1F, 0o17 and 1_000 came out as 0, 0 and 1 with no error. Integers now go through the existing parseInt64, and floats strip underscores and use strconv.ParseFloat.

Added an encode test (YAML to HCL) covering hex, octal, underscored and negative-hex integers plus an underscored float. It fails without the fix and passes with it. TestJSONScenarios also fails on a clean master checkout, so it is not related.

Copilot AI balanced review requested due to automatic review settings October 17, 2026 06:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HCL encoder silently corrupts hex, octal and underscored integers

2 participants