From 828fc4129af57c898bea5ee7451cc28d845fb8a5 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Tue, 24 Nov 2020 14:15:20 -0500 Subject: [PATCH] add for user-defined functions overriding built-in functions, as in the C impl --- go/src/miller/dsl/cst/udf.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/go/src/miller/dsl/cst/udf.go b/go/src/miller/dsl/cst/udf.go index ea6c92f7d..63705f26f 100644 --- a/go/src/miller/dsl/cst/udf.go +++ b/go/src/miller/dsl/cst/udf.go @@ -257,6 +257,15 @@ func (this *RootNode) BuildAndInstallUDF(astNode *dsl.ASTNode) error { functionName := string(astNode.Token.Lit) + if BuiltinFunctionManagerInstance.LookUp(functionName) != nil { + return errors.New( + fmt.Sprintf( + "Miller: function named \"%s\" must not override a built-in function of the same name.", + functionName, + ), + ) + } + if this.udfManager.ExistsByName(functionName) { return errors.New( fmt.Sprintf(