-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
While trying to get something to work, I got to this minimal example, which resulted in an error that sounded like something in the S7 internals broke. Maybe I did someting obviously wrong, but I figured I'd file an issue just in case:
Error: <TestClass> object is invalid:
- Underlying data is corrupt
4.
stop(msg, call. = FALSE)
3.
function (object, recursive = TRUE, properties = TRUE)
{
check_is_S7(object)
if (!is.null(attr(object, ".should_validate"))) { ...
2.
`prop<-`(`*tmp*`, "x", value = 10)
1.
TestClass(x = 10)
Minimal Example:
TestClass <- S7::new_class(
"TestClass",
properties = list(
x = S7::new_property(default = NULL, validator = function(value) {
if (!is.null(value) && !is.numeric(value)) {
"@x must be numeric"
}
})
),
constructor = function(x = NULL) {
obj <- new_object(.parent = TestClass)
if (!is.null(x)) {
prop(obj, "x") <- x
}
obj
}
)
test_obj <- TestClass(x = 10)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels