Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@evalNamespace fails with warning #1022

Closed
hughjonesd opened this issue Jan 6, 2020 · 3 comments
Closed

@evalNamespace fails with warning #1022

hughjonesd opened this issue Jan 6, 2020 · 3 comments
Labels
bug an unexpected problem or unintended behavior namespace 👩‍🚀
Milestone

Comments

@hughjonesd
Copy link
Contributor

hughjonesd commented Jan 6, 2020

In hello.R:

#' @evalNamespace "export(foo)"
NULL

If I run roxygen2::roxygenize() using version 6.1.1, this creates a NAMESPACE file containing the line

export(foo)

as expected. However, using version 7.0.2, I get a warning:

Warning: [/Users/david/packagefileprob/R/hello.R:1] @evalNamespace failed with error:
invalid 'envir' argument of type 'closure'

and the line is not written in NAMESPACE.

The error appears to be that in roxy_tag_eval, env is not being passed, and is instead being taken to be rlang::env. The original cause seems to be this line in roclet_preprocess.roclet_namespace:

  lines <- blocks_to_ns(blocks, env, import_only = TRUE)

which refers to a not locally defined env variable.

@hadley hadley added bug an unexpected problem or unintended behavior namespace 👩‍🚀 labels Mar 5, 2020
@hadley hadley added this to the 7.1.0 milestone Mar 5, 2020
@hadley
Copy link
Member

hadley commented Mar 9, 2020

Looks like the problem was introduced here: 8c82a07#diff-85658d9a5cecb42c8e8957560ab6d7abL54-L65

@hadley hadley closed this as completed in ee93506 Mar 10, 2020
@hadley
Copy link
Member

hadley commented Mar 10, 2020

Fixed now — would you mind sharing what you're using @evalNamespace for?

@hughjonesd
Copy link
Contributor Author

It's for autogeneration of a lot of namespace entries, see here:
https://github.com/hughjonesd/huxtable/blob/master/R/properties.R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior namespace 👩‍🚀
Projects
None yet
Development

No branches or pull requests

2 participants