diff --git a/DESCRIPTION b/DESCRIPTION index a5f6bdc8..7671c591 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -34,7 +34,7 @@ Config/testthat/parallel: true Encoding: UTF-8 NeedsCompilation: yes Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Collate: 'Dictionary.R' 'named_list.R' diff --git a/NEWS.md b/NEWS.md index af4b500b..07e22e89 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # mlr3misc (development version) +* Bugfix: `crate()` is using the correct 'topenv' environment now. + # mlr3misc 0.15.1 * refactor: Update `as_callback()` functions. diff --git a/R/crate.R b/R/crate.R index aaf9cddc..eaae3c5f 100644 --- a/R/crate.R +++ b/R/crate.R @@ -28,7 +28,7 @@ #' z = 300 #' f = meta_f(1) #' f() -crate = function(.fn, ..., .parent = topenv(), .compile = TRUE) { +crate = function(.fn, ..., .parent = topenv(parent.frame()), .compile = TRUE) { assert_flag(.compile) .compile = .compile || is_compiled(.fn) nn = map_chr(substitute(list(...)), as.character)[-1L] diff --git a/man/crate.Rd b/man/crate.Rd index a84039ff..c8699d41 100644 --- a/man/crate.Rd +++ b/man/crate.Rd @@ -4,7 +4,7 @@ \alias{crate} \title{Isolate a Function from its Environment} \usage{ -crate(.fn, ..., .parent = topenv(), .compile = TRUE) +crate(.fn, ..., .parent = topenv(parent.frame()), .compile = TRUE) } \arguments{ \item{.fn}{(\verb{function()})\cr