Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17427422c1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function_variadic_advanced <- function(x){ | ||
| if(!is.function(x)) | ||
| return("{.strong '{arg_name}'} must be a function, not a {class(arg_value)}") | ||
|
|
||
| if(!func_supports_variable_arguments(x)) | ||
| return("{.strong '{arg_name}'} must accept variable arguments via {.strong ...}") |
There was a problem hiding this comment.
Treat primitives with NULL args() as variadic
assert_function_variadic() relies on func_supports_variable_arguments(), which in turn inspects names(formals(args(func))). For several base primitives (e.g., subsetting [/[[), args() returns NULL even though the function accepts ..., so this check returns FALSE and the new assertion incorrectly fails for genuinely variadic primitives. This means callers trying to assert variadic behavior on such primitives will get a false negative. Consider a fallback that treats args(func) == NULL differently (or a different detection strategy) so primitives with undocumented signatures aren’t misclassified.
Useful? React with 👍 / 👎.
Motivation
Description
tests/testthat/test-assert_functions.Rwhile preserving the new per-expectation comments and blank-line formatting for theassert_function_variadic()block.function_variadic_advanced()inR/assert_functions.R, the exportedassert_function_variadicinNAMESPACE,man/assert_function_variadic.Rd, and theNEWS.mdentry.Testing
devtools::document()successfully with updated documentation generated.devtools::test()and all tests passed ([ FAIL 0 | WARN 0 | SKIP 0 | PASS 995 ]).devtools::check()which completed with 0 errors, 0 warnings and 1 NOTE (unable to verify current time).Codex Task