lang: funcs: simple: Check for function signatures

Make sure that we actually get function types here. This is just an
extra safety check.
This commit is contained in:
James Shubin
2021-05-23 17:42:50 -04:00
parent eb1053607a
commit 21c97d255f

View File

@@ -48,6 +48,9 @@ func Register(name string, fn *types.FuncValue) {
if fn.T == nil { if fn.T == nil {
panic(fmt.Sprintf("simple func %s contains a nil type signature", name)) 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() { if fn.T.HasVariant() {
panic(fmt.Sprintf("simple func %s contains a variant type signature", name)) panic(fmt.Sprintf("simple func %s contains a variant type signature", name))
} }