Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward to 1.5.0 #10

Merged
merged 7 commits into from
Mar 6, 2025
Merged

Forward to 1.5.0 #10

merged 7 commits into from
Mar 6, 2025

Conversation

bbasata
Copy link
Collaborator

@bbasata bbasata commented Mar 6, 2025

Previously: #8

This PR updates this repo for parity with zclconf/go-cty v1.5.0. The changes remain "Unreleased" with no new release tag for the moment. This prevents a flood of Dependabot PRs like hashicorp/terraform-plugin-testing#444 for all affected providers.

Verification:

$ git ls-remote upstream refs/tags/v1.5.0^{}
17dfd6f7bef43edcb91484e94cedd0eafb393266	refs/tags/v1.5.0^{}

# Check for non-trivial diffs between this v1.5.0 and upstream v1.5.0
$ git diff -U0 --ignore-matching-lines 'github.com/(hashicorp|zclconf)/go-cty' 17dfd6f7bef43edcb91484e94cedd0eafb393266..HEAD -- . ':(exclude).github/CODEOWNERS'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c0bf2c5..7cb85b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1 +1 @@
-# 1.5.0 (June 11, 2020)
+# 1.5.0 (Unreleased)
@@ -6 +6 @@
-# 1.4.2 (May 29, 2020)
+# 1.4.2 (Unreleased)
@@ -10 +11 @@
-# 1.4.1 (May 18, 2020)
+# 1.4.1 (March 5, 2025)
diff --git a/cty/function/stdlib/string.go b/cty/function/stdlib/string.go
index 01ebc47..60e0ab5 100644
--- a/cty/function/stdlib/string.go
+++ b/cty/function/stdlib/string.go
@@ -154 +153,0 @@ var SubstrFunc = function.New(&function.Spec{
-

$ go1.12 test ./...
ok  	github.com/hashicorp/go-cty/cty	(cached)
ok  	github.com/hashicorp/go-cty/cty/convert	(cached)
ok  	github.com/hashicorp/go-cty/cty/function	(cached)
ok  	github.com/hashicorp/go-cty/cty/function/stdlib	(cached)
ok  	github.com/hashicorp/go-cty/cty/gocty	(cached)
ok  	github.com/hashicorp/go-cty/cty/json	(cached)
ok  	github.com/hashicorp/go-cty/cty/msgpack	(cached)
ok  	github.com/hashicorp/go-cty/cty/set	(cached)

# Check for any un-replaced imports
$  ag zclconf -G '.go$'

apparentlymart and others added 7 commits March 6, 2025 12:55
Tuples with elements of different types can be converted to homogeneous
collections (sets or lists), so long as their elements are unifiable.
For example:

  list("a", "b")     // all elements have the same type
  list("a", 5)       // "a" and 5 can be unified to string
  list("a", 5, null) // null is a valid value for string

However, tuples with elements which are not unifiable cannot be
converted to homogeneous collections:

  list(["a"], "b")   // no common type for list(string) and string

This commit fixes a panic for this failure case, when the tuple contains
both non-unifiable types and a null value:

  list(["a"], "b", null) // should not panic

The null value was causing the unification process to result in a list
or set of dynamic type, which causes the conversion functions to pass
through the original value. This meant that in the final conversion
step, we would attempt to construct a list or set of different values,
which panics.
This tests whether a value contains any unknown values of unknown type.

This is different than just testing if any of the nested types
are DynamicPseudoType, because a null value of
DynamicPseudoType has a different meaning than an
unknown value of DynamicPseudoType: the null value's
type can't become any more "known".
@bbasata bbasata requested a review from a team as a code owner March 6, 2025 18:02
@bbasata bbasata changed the title Forward to 1 5 0 Forward to 1.5.0 Mar 6, 2025
@bbasata bbasata merged commit 08cd546 into master Mar 6, 2025
1 check passed
@bbasata bbasata deleted the forward-to-1-5-0 branch March 6, 2025 19:11
bbasata added a commit to hashicorp/terraform-plugin-sdk that referenced this pull request Mar 17, 2025
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.

None yet

5 participants