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

Fix CRAN warning due to S3 conditional registration #1832

Merged
merged 3 commits into from
Apr 19, 2023

Conversation

DavisVaughan
Copy link
Member

CC @lionel-

Fixes this NOTE seen in CRAN's checks on R-devel (>=4.3.0 at the time).

* checking S3 generic/method consistency ... NOTE
Apparent methods for exported generics not registered:
  vec_cast.data.frame.grouped_df vec_cast.data.frame.rowwise_df
  vec_cast.data.frame.sf vec_cast.data.frame.tbl_df
  vec_cast.grouped_df.data.frame vec_cast.grouped_df.grouped_df
  vec_cast.grouped_df.tbl_df vec_cast.rowwise_df.data.frame
  vec_cast.rowwise_df.rowwise_df vec_cast.rowwise_df.tbl_df
  vec_cast.sf.data.frame vec_cast.sf.sf vec_cast.tbl_df.data.frame
  vec_cast.tbl_df.grouped_df vec_cast.tbl_df.rowwise_df
  vec_cast.tbl_df.tbl_df vec_proxy.sf vec_proxy_order.sfc
  vec_ptype2.data.frame.grouped_df vec_ptype2.data.frame.rowwise_df
  vec_ptype2.data.frame.sf vec_ptype2.data.frame.tbl_df
  vec_ptype2.grouped_df.data.frame vec_ptype2.grouped_df.grouped_df
  vec_ptype2.grouped_df.tbl_df vec_ptype2.rowwise_df.data.frame
  vec_ptype2.rowwise_df.rowwise_df vec_ptype2.rowwise_df.tbl_df
  vec_ptype2.sf.data.frame vec_ptype2.sf.sf vec_ptype2.sf.tbl_df
  vec_ptype2.tbl_df.data.frame vec_ptype2.tbl_df.grouped_df
  vec_ptype2.tbl_df.rowwise_df vec_ptype2.tbl_df.sf
  vec_ptype2.tbl_df.tbl_df vec_restore.grouped_df
  vec_restore.rowwise_df vec_restore.sf
See section 'Registering S3 methods' in the 'Writing R Extensions'
manual.

This is due to some rewriting of the S3 generics/method check system:
r-devel/r-svn@d34f52a

It only affects methods that we conditionally register which aren't actually registered at vctrs load time. i.e. the dplyr methods are conditionally registered:

  • When dplyr is eventually loaded
  • If dplyr doesn't already have these methods itself (which it doesn't as of dplyr 1.1.1)

I imagine the CRAN check sees that vctrs is "fully loaded" but it didn't officially register S3 methods for these functions that "look" like S3 methods due to the . in their names, and that triggers the note.

Switching from a . to an _ should avoid the NOTE, but also requires manual registration of the method in s3_register().

@DavisVaughan
Copy link
Member Author

I can reproduce on r-devel locally with this new envvar:

devtools::check(env_vars = c(NOT_CRAN = "true", `_R_CHECK_S3_METHODS_SHOW_POSSIBLE_ISSUES_` = "true"))

I have confirmed that with this PR it no longer shows the NOTE.

@DavisVaughan DavisVaughan merged commit 482a6e4 into r-lib:main Apr 19, 2023
@DavisVaughan DavisVaughan deleted the fix/s3-dot-to-underscore branch April 19, 2023 18:18
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.

1 participant