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

name needs a default value in use_rcpp() ... #1953

Open
jennybc opened this issue Feb 27, 2024 · 0 comments
Open

name needs a default value in use_rcpp() ... #1953

jennybc opened this issue Feb 27, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior code 🖥️ R/, tests/

Comments

@jennybc
Copy link
Member

jennybc commented Feb 27, 2024

name needs a default value in use_rcpp() or we should check name earlier and exit early and informatively if not provided.

Introduced in 3c03f5c.

use_rcpp() now errors if called without name and the error is pretty confusing:

Error in `use_rcpp()`:
! Open file must be a code or test file.

It's actually coming from the internal helper compute_name(). This (inherited) documented behaviour:

#' @param name Either a string giving a file name (without directory) or
#'   `NULL` to take the name from the currently open file in RStudio.

doesn't make any sense for use_rcpp(), i.e. what does the currently open file have to do with it. And, as I just found, there might not even be a currently open file.

Check if this affects other functions, e.g. use_c(), that were also touched.

@jennybc jennybc added bug an unexpected problem or unintended behavior code 🖥️ R/, tests/ labels Feb 27, 2024
@jennybc jennybc changed the title name needs a default value in use_rcpp() name needs a default value in use_rcpp() ... Feb 27, 2024
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 code 🖥️ R/, tests/
Projects
None yet
Development

No branches or pull requests

1 participant