Closed
Description
MWE:
dir.create('test/R', recursive = TRUE)
writeLines(
r'[f = function (x) UseMethod('f')
`f.(` = function (x) x
`f.{` = function (x) x]',
'test/R/test.r'
)
desc = list
76F5
span>(
Package = 'Test',
Version = '0.0.1',
License = 'MIT = file',
Description = 'For testing.',
Title = 'For Testing',
`Authors@R` = 'person("F", "L", role = c("cre", "aut"))'
)
write.dcf(desc, 'test/DESCRIPTION')
roxygen2::roxygenize('test')
This leads to:
First time using roxygen2. Upgrading automatically...
Setting `RoxygenNote` to "7.3.0"
✖ roxygen2 requires "Encoding: UTF-8"
ℹ Current encoding is NA
ℹ Loading Test
Error in `map2()`:
ℹ In index: 1.
ℹ With name: f.{.
Caused by error in `glue()`:
! Unterminated quote (`)
Run `rlang::last_trace()` to see where the error occurred.
rlang::last_trace(drop = FALSE)
:
<error/purrr_error_indexed>
Error in `map2()`:
ℹ In index: 1.
ℹ With name: f.{.
Caused by error in `glue()`:
! Unterminated quote (`)
---
Backtrace:
▆
1. ├─roxygen2::roxygenize("test")
2. │ └─base::lapply(...)
3. │ ├─roxygen2 (local) FUN(X[[i]], ...)
4. │ └─roxygen2:::roclet_process.roclet_namespace(X[[i]], ...)
5. │ └─roxygen2:::warn_missing_s3_exports(blocks, env)
6. │ └─purrr::map2(undocumented, messages, warn_roxy_function)
7. │ └─purrr:::map2_("list", .x, .y, .f, ..., .progress = .progress)
8. │ ├─purrr:::with_indexed_errors(...)
9. │ │ └─base::withCallingHandlers(...)
10. │ ├─purrr:::call_with_cleanup(...)
11. │ └─roxygen2 (local) .f(.x[[i]], .y[[i]], ...)
12. │ └─roxygen2:::warn_roxy(file, line, message, parent = parent, envir = envir)
13. │ └─cli::cli_inform(message, parent = parent, .envir = envir)
14. │ ├─rlang::inform(format_message(message, .envir = envir), ...)
15. │ │ └─message %||% ""
16. │ └─cli::format_message(message, .envir = .envir)
17. │ ├─cli::cli_fmt(...)
18. │ │ └─cli:::cli__rec(expr)
19. │ └─(function() {...
20. │ └─cli::cli_bullets(message, .envir = .envir)
21. │ ├─cli:::cli__message(...)
22. │ │ └─"id" %in% names(args)
23. │ ├─base::structure(lapply(text, glue_cmd, .envir = .envir), names = names(text))
24. │ └─base::lapply(text, glue_cmd, .envir = .envir)
25. │ └─cli (local) FUN(X[[i]], ...)
26. │ └─cli:::glue(...)
27. └─base::.handleSimpleError(...)
28. └─purrr (local) h(simpleError(msg, call))
29. └─cli::cli_abort(...)
30. └─rlang::abort(...)
The offending package code is:
f = function (x) UseMethod('f')
`f.(` = function (x) x
`f.{` = function (x) x
Note that f.(
is accepted, only f.{
causes an error.
The usage in actual code (in the ‘box’ package) needs this to dispatch on the type of an unevaluated R expression for an AST walker.