Skip to content

Commit 357f749

Browse files
committed
new_tibble() supports language objects again
1 parent c079651 commit 357f749

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

R/new.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ new_tibble <- function(x, ..., nrow = NULL, class = NULL, subclass = NULL) {
9696
# `new_data_frame()` restores compact row names
9797
args[["row.names"]] <- NULL
9898

99-
# do.call() is faster than exec() in this case
100-
do.call(new_data_frame, args)
99+
# need exec() to avoid evaluating language attributes (e.g. rsample)
100+
exec(new_data_frame, !!!args)
101101
}
102102

103103
#' @description

tests/testthat/test-new.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ test_that("new_tibble() supports missing `nrow` (#781)", {
8989
expect_identical(new_tibble(list(a = 1:3)), tibble(a = 1:3))
9090
})
9191

92+
test_that("new_tibble() supports language objects", {
93+
expect_identical(
94+
new_tibble(list(), foo = quote(bar())),
95+
structure(new_tibble(list()), foo = quote(bar()))
96+
)
97+
})
98+
9299
test_that("new_tibble checks", {
93100
scoped_lifecycle_errors()
94101

0 commit comments

Comments
 (0)