function.go: if the right most parameter is repeteable (pfRepeat), then it does not increment the min-arg count

This commit is contained in:
Celestino Amoroso 2024-06-02 11:30:24 +02:00
parent c04678c426
commit e4b4b4fb79

View File

@ -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 {