mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
minor fixes
This commit is contained in:
parent
0dbecc54c0
commit
c23a971ed1
@ -273,7 +273,6 @@ var DistinctFunc = function.New(&function.Spec{
|
|||||||
Type: func(args []cty.Value) (cty.Type, error) {
|
Type: func(args []cty.Value) (cty.Type, error) {
|
||||||
return args[0].Type(), nil
|
return args[0].Type(), nil
|
||||||
},
|
},
|
||||||
// Type: function.StaticReturnType(cty.List(cty.DynamicPseudoType)),
|
|
||||||
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
||||||
listVal := args[0]
|
listVal := args[0]
|
||||||
|
|
||||||
@ -646,7 +645,7 @@ var MatchkeysFunc = function.New(&function.Spec{
|
|||||||
return cty.ListValEmpty(retType.ElementType()), nil
|
return cty.ListValEmpty(retType.ElementType()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !args[0].IsWhollyKnown() || !args[0].IsWhollyKnown() {
|
if !values.IsWhollyKnown() || !keys.IsWhollyKnown() {
|
||||||
return cty.UnknownVal(retType), nil
|
return cty.UnknownVal(retType), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -838,6 +837,11 @@ var ValuesFunc = function.New(&function.Spec{
|
|||||||
},
|
},
|
||||||
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {
|
||||||
mapVar := args[0]
|
mapVar := args[0]
|
||||||
|
|
||||||
|
if mapVar.LengthInt() == 0 {
|
||||||
|
return cty.ListValEmpty(retType.ElementType()), nil
|
||||||
|
}
|
||||||
|
|
||||||
if !mapVar.IsWhollyKnown() {
|
if !mapVar.IsWhollyKnown() {
|
||||||
return cty.UnknownVal(retType), nil
|
return cty.UnknownVal(retType), nil
|
||||||
}
|
}
|
||||||
@ -856,7 +860,7 @@ var ValuesFunc = function.New(&function.Spec{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(values) == 0 {
|
if len(values) == 0 {
|
||||||
return cty.ListValEmpty(retType), nil
|
return cty.ListValEmpty(retType.ElementType()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return cty.ListVal(values), nil
|
return cty.ListVal(values), nil
|
||||||
|
@ -1920,6 +1920,11 @@ func TestValues(t *testing.T) {
|
|||||||
cty.UnknownVal(cty.List(cty.List(cty.String))),
|
cty.UnknownVal(cty.List(cty.List(cty.String))),
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
{ // empty m
|
||||||
|
cty.MapValEmpty(cty.DynamicPseudoType),
|
||||||
|
cty.ListValEmpty(cty.DynamicPseudoType),
|
||||||
|
false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user