You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# note that this doesn't include unnamed args forwarded through `...`.
132
+
dots_i<- which(remaining_args_names=="...") # integer(0) if no match
133
+
n_f_args_before_dots<-dots_i-1L
134
+
if (length(dots_i) !=0L) { # `f` has a dots "arg"
114
135
# Keep all arg names before `...`
115
-
dots_i<- which(arg_names=="...")
116
-
arg_names<-arg_names[seq_len(dots_i-1)]
117
-
118
-
if (length(arg_names) <n_mandatory_f_args) {
119
-
Warn(sprintf("`f` only takes %s positional arguments before the `...` args, but %s were expected; this can lead to obtuse errors downstream", length(arg_names), n_mandatory_f_args),
"`f` might not have enough positional arguments before its `...`; in the current `epi[x]_slide` call, the {mandatory_f_args_in_f_dots} will be included in `f`'s `...`; if `f` doesn't expect those arguments, it may produce confusing error messages",
# less common; highlight that they are (accidentally?) using dots forwarding
158
+
Abort(sprintf("`f` must take at least %s arguments plus the %s arguments forwarded through `epi[x]_slide`'s `...`, or a named argument to `epi[x]_slide` was misspelled", n_mandatory_f_args, rlang::dots_n(...)),
cli::cli_abort("`epi[x]_slide` would pass the {mandatory_args_replacing_defaults} to `f`'s {args_with_default_replaced_by_mandatory} argument{?s}, which {?has a/have} default value{?s}; we suspect that `f` doesn't expect {?this arg/these args} at all and may produce confusing error messages. Please add additional arguments to `f` or remove defaults as appropriate.",
0 commit comments