Merge pull request #21734 from pselle/merge-null

Don't allow nulls in calls to merge
This commit is contained in:
Pam Selle 2019-06-17 10:19:28 -04:00 committed by GitHub
commit 63ca536e41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -876,7 +876,6 @@ var MergeFunc = function.New(&function.Spec{
Name: "maps",
Type: cty.DynamicPseudoType,
AllowDynamicType: true,
AllowNull: true,
},
Type: function.StaticReturnType(cty.DynamicPseudoType),
Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) {

View File

@ -2045,6 +2045,17 @@ func TestMerge(t *testing.T) {
cty.NilVal,
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
[]cty.Value{
cty.MapVal(map[string]cty.Value{