mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
bump github.com/zclconf/go-cty from 1.7.1 to 1.10.0
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
48
vendor/github.com/zclconf/go-cty/cty/value_init.go
generated
vendored
48
vendor/github.com/zclconf/go-cty/cty/value_init.go
generated
vendored
@ -186,6 +186,20 @@ func ListValEmpty(element Type) Value {
|
||||
}
|
||||
}
|
||||
|
||||
// CanListVal returns false if the given Values can not be coalesced
|
||||
// into a single List due to inconsistent element types.
|
||||
func CanListVal(vals []Value) bool {
|
||||
elementType := DynamicPseudoType
|
||||
for _, val := range vals {
|
||||
if elementType == DynamicPseudoType {
|
||||
elementType = val.ty
|
||||
} else if val.ty != DynamicPseudoType && !elementType.Equals(val.ty) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// MapVal returns a Value of a map type whose element type is defined by
|
||||
// the types of the given values, which must be homogenous.
|
||||
//
|
||||
@ -227,6 +241,20 @@ func MapValEmpty(element Type) Value {
|
||||
}
|
||||
}
|
||||
|
||||
// CanMapVal returns false if the given Values can not be coalesced into a
|
||||
// single Map due to inconsistent element types.
|
||||
func CanMapVal(vals map[string]Value) bool {
|
||||
elementType := DynamicPseudoType
|
||||
for _, val := range vals {
|
||||
if elementType == DynamicPseudoType {
|
||||
elementType = val.ty
|
||||
} else if val.ty != DynamicPseudoType && !elementType.Equals(val.ty) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// SetVal returns a Value of set type whose element type is defined by
|
||||
// the types of the given values, which must be homogenous.
|
||||
//
|
||||
@ -267,6 +295,26 @@ func SetVal(vals []Value) Value {
|
||||
}.WithMarks(markSets...)
|
||||
}
|
||||
|
||||
// CanSetVal returns false if the given Values can not be coalesced
|
||||
// into a single Set due to inconsistent element types.
|
||||
func CanSetVal(vals []Value) bool {
|
||||
elementType := DynamicPseudoType
|
||||
var markSets []ValueMarks
|
||||
|
||||
for _, val := range vals {
|
||||
if unmarkedVal, marks := val.UnmarkDeep(); len(marks) > 0 {
|
||||
val = unmarkedVal
|
||||
markSets = append(markSets, marks)
|
||||
}
|
||||
if elementType == DynamicPseudoType {
|
||||
elementType = val.ty
|
||||
} else if val.ty != DynamicPseudoType && !elementType.Equals(val.ty) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// SetValFromValueSet returns a Value of set type based on an already-constructed
|
||||
// ValueSet.
|
||||
//
|
||||
|
Reference in New Issue
Block a user