Merge pull request #21734 from pselle/merge-null
Don't allow nulls in calls to merge
This commit is contained in:
commit
63ca536e41
|
@ -876,7 +876,6 @@ var MergeFunc = function.New(&function.Spec{
|
||||||
Name: "maps",
|
Name: "maps",
|
||||||
Type: cty.DynamicPseudoType,
|
Type: cty.DynamicPseudoType,
|
||||||
AllowDynamicType: true,
|
AllowDynamicType: true,
|
||||||
AllowNull: true,
|
|
||||||
},
|
},
|
||||||
Type: function.StaticReturnType(cty.DynamicPseudoType),
|
Type: function.StaticReturnType(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) {
|
||||||
|
|
|
@ -2045,6 +2045,17 @@ func TestMerge(t *testing.T) {
|
||||||
cty.NilVal,
|
cty.NilVal,
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ // argument error, for a null type
|
||||||
|
[]cty.Value{
|
||||||
|
cty.MapVal(map[string]cty.Value{
|
||||||
|
"a": cty.StringVal("b"),
|
||||||
|
}),
|
||||||
|
cty.NullVal(cty.String),
|
||||||
|
},
|
||||||
|
cty.NilVal,
|
||||||
|
true,
|
||||||
|
},
|
||||||
{ // merge maps of maps
|
{ // merge maps of maps
|
||||||
[]cty.Value{
|
[]cty.Value{
|
||||||
cty.MapVal(map[string]cty.Value{
|
cty.MapVal(map[string]cty.Value{
|
||||||
|
|
Loading…
Reference in New Issue