lang: funcs: Verify that simple polyfunc list is not empty

This could prevent some incorrect usage of the simplepoly API.
This commit is contained in:
James Shubin
2019-05-22 13:14:07 -04:00
parent 3f1a379908
commit 3b608ad544

View File

@@ -42,6 +42,10 @@ func Register(name string, fns []*types.FuncValue) {
panic(fmt.Sprintf("a simple polyfunc named %s is already registered", name))
}
if len(fns) == 0 {
panic("no functions specified for simple polyfunc")
}
// check for uniqueness in type signatures
typs := []*types.Type{}
for _, f := range fns {