You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Changelog preparation for future 1.4.2 release
* convert: Fix panic: heterogeneous tuple with null
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.
* Update CHANGELOG.md
* cty: Value.HasWhollyKnownType
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".
* Update CHANGELOG.md
* v1.5.0
* Update CHANGELOG.md
---------
Co-authored-by: Martin Atkins <[email protected]>
Co-authored-by: Alisdair McDiarmid <[email protected]>
Co-authored-by: James Bardin <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,8 @@
1
+
# 1.5.0 (Unreleased)
2
+
3
+
*`cty`: New `Value.HasWhollyKnownType` method, for testing whether a value's type could potentially change if any unknown values it was constructed from were to become known. ([#55](https://github.com/zclconf/go-cty/pull/55))
4
+
*`convert`: Fix incorrect panic when converting a tuple with a dynamic-typed null member into a list or set, due to overly-liberal type unification. ([#56](https://github.com/zclconf/go-cty/pull/56))
5
+
1
6
# 1.4.2 (Unreleased)
2
7
3
8
*`function/stdlib`: The `jsonencode` function will now correctly accept a null as its argument, and produce the JSON representation `"null"` rather than returning an error. ([#54](https://github.com/zclconf/go-cty/pull/54))
0 commit comments