Closed krlmlr closed 3 months ago
This was a typo in an edge case hard to test, some environments are created with a NULL parent, though according to the doc NULL parents are not supported anymore.
The current code only supports ".env" for the latter because the parent can't be set, but this could be improved since some constructors don't respect the parent anyway. Keep me informed if you need need this feature.
Thanks. According to dput()
this is a "weakref" . I was just surprised that constructive yelled at me, no particular action is necessary now.
yes there was a weakref, but weakrefs are built by rlang::new_weakref on top of environments or external pointers (returned by rlang::wref_key(x)
), and in that case this environment had a NULL
parent.
.cstr_construct.weakref.new_weakref <- function(x, ...) {
args <- list(rlang::wref_key(x))
# assigned this way so no element is added if NULL
args$value <- rlang::wref_value(x)
code <- .cstr_apply(args, "rlang::new_weakref", ...)
repair_attributes_weakref(x, code, ...)
}
Created on 2024-08-22 with reprex v2.1.0