-
Notifications
You must be signed in to change notification settings - Fork 238
Description
Dear roxygen2 development experts,
I'm getting the following error when running devtools::document() with roxygen2 version '7.3.2':
Error in match(x, table, nomatch = 0L) :
cannot get a slot ("slots") from an object of type "NULL"
The problem does not occur with roxygen2 version '7.2.3'. This error can be reproduced by cloning the JonathanUrbach/GSNA repository with the shell command:
git clone https://github.com/JonathanUrbach/GSNA.git
Then, under R running:
devtools::document()
I have traced the failure to an error when running the roxygen2::warn_missing_s3_exports function. The call trace looks like this:
7: methods %in% s3objects
6: warn_missing_s3_exports(blocks, env)
5: roclet_process.roclet_namespace(X[[i]], ...)
4: FUN(X[[i]], ...)
3: lapply(roclets, roclet_process, blocks = blocks, env = env, base_path = base_path)
2: roxygen2::roxygenise(pkg$path, roclets)
1: devtools::document()
The error happens on this line:
s3objects <- map(blocks, function(block) block$object$value)
This appears to fail because the blocks list contains items like the following, which have NULL values for their associated object elements:
[[1]]
<roxy_block> [GSNA-package.R:5]
$tag
[line: 3] @useDynLib 'GSNA, .registration = TRUE' {parsed}
[line: 5] @backref '<generated>' {parsed}
$call NULL
$object NULL
[[2]]
<roxy_block> [GSNA-package.R:10]
$tag
[line: 8] @importFrom 'Rcpp sourceCpp' {parsed}
[line: 10] @backref '<generated>' {parsed}
$call NULL
$object NULL
Given the assignment of the s3blocks variable on the previous line, the following version, using s3blocks as the list argument of map() seems better, and runs without the above error:
s3blocks <- blocks[map_lgl(blocks, block_has_tags, c("export", "exportS3Method"))]
s3objects <- map(s3blocks, function(block) block$object$value)
If this is somehow incorrect, can you suggest a workaround?
Thank you for your consideration.
Sincerely,
Jonathan Urbach