From c163ba71db5d1c73bbd888718cedc0b214cac002 Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Tue, 4 Jun 2019 11:54:26 -0400 Subject: [PATCH] simplify --- lang/funcs/collection.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/lang/funcs/collection.go b/lang/funcs/collection.go index 232dd4258..ab68a6411 100644 --- a/lang/funcs/collection.go +++ b/lang/funcs/collection.go @@ -800,14 +800,7 @@ var MatchkeysFunc = function.New(&function.Spec{ }, }, Type: func(args []cty.Value) (cty.Type, error) { - // Verify that args[1] (keys) and args[2] (searchset) are of the same - // (or unifiable) type - argTypes := make([]cty.Type, 2) - for i := 0; i < 2; i++ { - argTypes[i] = args[i+1].Type() - } - - ty, _ := convert.UnifyUnsafe(argTypes) + ty, _ := convert.UnifyUnsafe([]cty.Type{args[1].Type(), args[2].Type()}) if ty == cty.NilType { return cty.NilType, errors.New("keys and searchset must be of the same type") } @@ -830,11 +823,7 @@ var MatchkeysFunc = function.New(&function.Spec{ // Keys and searchset must be the same type. // We can skip error checking here because we've already verified that // they can be unified in the Type function - argTypes := make([]cty.Type, 2) - for i := 0; i < 2; i++ { - argTypes[i] = args[i+1].Type() - } - ty, _ := convert.UnifyUnsafe(argTypes) + ty, _ := convert.UnifyUnsafe([]cty.Type{args[1].Type(), args[2].Type()}) keys, _ := convert.Convert(args[1], ty) searchset, _ := convert.Convert(args[2], ty)