lang: funcs: Check for functions that haven't been migrated
All polymorphic functions should use the new API, at least until we either implement a compat wrapper. But it's probably best if we get rid of the old API as soon as we make all this type unification work properly.
This commit is contained in:
@@ -72,6 +72,13 @@ func Register(name string, fn func() interfaces.Func) {
|
||||
// panic(fmt.Sprintf("a func named %s is invalid", name))
|
||||
//}
|
||||
|
||||
fnx := fn() // check that all functions have migrated to the new API!
|
||||
if _, ok := fnx.(interfaces.OldPolyFunc); ok {
|
||||
if _, ok := fnx.(interfaces.PolyFunc); !ok {
|
||||
panic(fmt.Sprintf("a func named %s implements OldPolyFunc but not PolyFunc", name))
|
||||
}
|
||||
}
|
||||
|
||||
//gob.Register(fn())
|
||||
registeredFuncs[name] = fn
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user