From 21c97d255f68be3a734694ba9ab61923dde339b5 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sun, 23 May 2021 17:42:50 -0400 Subject: [PATCH] lang: funcs: simple: Check for function signatures Make sure that we actually get function types here. This is just an extra safety check. --- lang/funcs/simple/simple.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lang/funcs/simple/simple.go b/lang/funcs/simple/simple.go index 44d006df..03f7b39e 100644 --- a/lang/funcs/simple/simple.go +++ b/lang/funcs/simple/simple.go @@ -48,6 +48,9 @@ func Register(name string, fn *types.FuncValue) { if fn.T == nil { panic(fmt.Sprintf("simple func %s contains a nil type signature", name)) } + if fn.T.Kind != types.KindFunc { + panic(fmt.Sprintf("simple func %s must be of kind func", name)) + } if fn.T.HasVariant() { panic(fmt.Sprintf("simple func %s contains a variant type signature", name)) }