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

load_all() error when using setOldClass() with inheritance #848

Closed
famuvie opened this issue Jun 11, 2015 · 1 comment
Closed

load_all() error when using setOldClass() with inheritance #848

famuvie opened this issue Jun 11, 2015 · 1 comment

Comments

@famuvie
Copy link

famuvie commented Jun 11, 2015

I have prepared a MRE for this issue, as a dummy package that can be installed and tested quickly.

In summary, I need to register some S3 classes with inheritance structure using setOldClass().

#' @importFrom methods setOldClass
methods::setOldClass(c('derived_class', 'my_class'))

When I load_all() for the first time, everything goes fine. But for successive times, it fails as follows:

Loading testpkg
Error in methods::setOldClass(c("derived_class", "my_class")) (from testmethod.R#3) : 
  inconsistent old-style class information for “derived_class”; the class is defined but does not extend “my_class” and is not valid as the data part

Variations:

  • The error does not occur if the class to be registered is single (i.e. setOldClass('my_class')).
  • Incomprehensibly, it does not occur either if the derived class name is 'splines' (!?!?)
  • Finally, the error still occurs if I register 'my_class' beforehand in a separate sentence.
> session_info()
Session info ---------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.0 (2015-04-16)
 system   x86_64, linux-gnu           
 ui       RStudio (0.99.441)          
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       <NA>                        

Packages -------------------------------------------------------------------------------------------------------------------
 package    * version date       source        
 devtools     1.7.0   2015-01-17 CRAN (R 3.1.2)
 digest     * 0.6.8   2014-12-31 CRAN (R 3.2.0)
 memoise    * 0.2.1   2014-04-22 CRAN (R 3.1.2)
 Rcpp       * 0.11.5  2015-03-06 CRAN (R 3.1.3)
 roxygen2   * 4.1.1   2015-04-15 CRAN (R 3.2.0)
 rstudioapi * 0.3.1   2015-04-07 CRAN (R 3.2.0)
 stringr    * 0.6.2   2012-12-06 CRAN (R 3.1.2)
famuvie pushed a commit to famuvie/devtools that referenced this issue Jun 11, 2015
prevents derived classes to remain orphan
Fixes r-lib#848
famuvie pushed a commit to famuvie/devtools that referenced this issue Jun 12, 2015
hadley added a commit that referenced this issue Sep 3, 2015
remove_s4_classes() respecting inheritance. Closes #848
@lock
Copy link

lock bot commented Sep 18, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant