Skip to content

Backport of update go-cty to v1.10.0 into v1.0#29871

Merged
jbardin merged 1 commit intov1.0from
backport/jbardin/update-cty/certainly-golden-kid
Nov 3, 2021
Merged

Backport of update go-cty to v1.10.0 into v1.0#29871
jbardin merged 1 commit intov1.0from
backport/jbardin/update-cty/certainly-golden-kid

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Nov 3, 2021

Backport

This PR is auto-generated from #29864 to be assessed for backporting due to the inclusion of the label 1.0-backport.

The below text is copied from the body of the original PR.


cty: The documented definition and comparison logic of cty.Number is now
refined to acknowledge that its true range is limited only to values
that have both a binary floating point and decimal representation,
because cty values are primarily designed to traverse JSON serialization
where numbers are always defined as decimal strings.

In particular, that means that two cty.Number values now always compare
as equal if their representation in JSON (under cty's own JSON encoder)
would be equal, even though the decimal approximation we use for that
conversion is slightly lossy. This pragmatic compromise avoids confusing
situations where a round-trip through JSON serialization (or other
serializations that use the same number format) may produce a value that
doesn't compare equal to the original.

This new definition of equals should not cause any significant behavior
change for any integer in our in-memory storage range, but may cause
some fractional values to compare equal where they didn't before if they
differ only by a small fraction.

Fixes #29861

@ghost ghost force-pushed the backport/jbardin/update-cty/certainly-golden-kid branch from 9ff3119 to c2c0f7d Compare November 3, 2021 12:57
@ghost ghost requested a review from jbardin November 3, 2021 12:57
@jbardin jbardin merged commit 874b391 into v1.0 Nov 3, 2021
@jbardin jbardin deleted the backport/jbardin/update-cty/certainly-golden-kid branch November 3, 2021 13:11
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 4, 2021

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant