From e4b4b4fb7956a5f8030cfbc6103ed58859b5cc2b Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Sun, 2 Jun 2024 11:30:24 +0200 Subject: [PATCH] function.go: if the right most parameter is repeteable (pfRepeat), then it does not increment the min-arg count --- function.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/function.go b/function.go index e127c23..5cedd7d 100644 --- a/function.go +++ b/function.go @@ -168,6 +168,7 @@ func newFuncInfo(name string, functor Functor, returnType string, params []ExprF return nil, fmt.Errorf("can't specify non-optional param after optional ones: %q", p.Name()) } if p.IsRepeat() { + minArgs-- maxArgs = -1 } } @@ -221,7 +222,7 @@ func (info *funcInfo) ToString(opt FmtOpt) string { if info.maxArgs < 0 { sb.WriteString(" ...") } - sb.WriteString("): ") + sb.WriteString("):") if len(info.returnType) > 0 { sb.WriteString(info.returnType) } else {