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

Bug cpp11 decorators #197

Merged
merged 12 commits into from
Jun 30, 2021
Merged

Bug cpp11 decorators #197

merged 12 commits into from
Jun 30, 2021

Conversation

sbearrows
Copy link
Contributor

Also added new tests for linking_to

fixes #193

Copy link
Member

@jimhester jimhester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to your changes (which look good!) I think we should remove the \dontrun{} block around the example at

#' \dontrun{
and Re-document.

I initially used \dontrun{} so users wouldn't be loading a shared library when they ran the examples, but I now think that isn't really a problem and it would have caught this regression during R CMD check.

Also possibly we should change Downloading in the example to Processing, otherwise when you run the examples it looks like you are downloading something, which might scare people.

R/register.R Outdated
@@ -279,7 +279,9 @@ get_cpp_register_needs <- function() {

check_valid_attributes <- function(decorations) {

bad_decor <- !decorations$decoration %in% c("cpp11::register", "cpp11::init")
bad_decor <- grepl("cpp11::", decorations$decoration) & (!decorations$decoration %in% c("cpp11::register",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

startsWith() would be slightly preferred here.

If you do want to use grepl() you need to anchor it to the start of the string, e.g. grepl("^cpp11::")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep you're right! Thanks for the review

R/register.R Outdated
Comment on lines 282 to 284
bad_decor <- startsWith(decorations$decoration, "cpp11::") & (!decorations$decoration %in% c("cpp11::register",
"cpp11::init",
"cpp11::linking_to"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still lining up like you wanted?

It might be worth doing the line breaking a bit differently, e.g.

Suggested change
bad_decor <- startsWith(decorations$decoration, "cpp11::") & (!decorations$decoration %in% c("cpp11::register",
"cpp11::init",
"cpp11::linking_to"))
bad_decor <- startsWith(decorations$decoration, "cpp11::") &
(!decorations$decoration %in% c("cpp11::register", "cpp11::init", "cpp11::linking_to"))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Looks nice

@jimhester jimhester merged commit ab20cd2 into r-lib:master Jun 30, 2021
@jimhester
Copy link
Member

Thanks!

@sbearrows sbearrows deleted the bug-cpp11_decorators branch July 6, 2021 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

linking_to attribute is no longer supported in cpp_source()
2 participants