Skip to content

underlying data corrupt #519

@sims1253

Description

@sims1253

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions