S4 Validity on ANY slot containing S3 Object

513 views Asked by At

Weird error popping up with S4 validity checks. Seems like S4 is trying to call a validity check on an non-S4 object:

setClass("test", slots=c(x="ANY"))
validObject(new("test", x=structure(TRUE, class=c("a"))), complete=TRUE)
# Error in .classEnv(classDef) : 
#  trying to get slot "package" from an object of a basic class ("NULL") with no slots

Compare to:

validObject(new("test", x=TRUE), complete=TRUE)
# [1] TRUE

Oddly I don't think I used to get this error previously, though I'm not sure what changed. This is running on R 3.1.2 and I'm almost certain it used to work previously on the same R version.

0

There are 0 answers