Skip to content

Commit

Permalink
Pass caller_env()
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Aug 15, 2024
1 parent e1ad6da commit d9584df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions R/list-transpose.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ list_transpose <- function(x,

if (length(x) == 0) {
template <- integer()
} else {
template <- template %||% reduce(map(x, vec_index), vec_set_union)
} else if (is.null(template)) {
template <- reduce(
map(x, vec_index),
vec_set_union,
error_call = caller_env()
)
}

if (!is.character(template) && !is.numeric(template)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/list-transpose.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
Code
list_transpose(list(x = list(a = 1, b = 2), y = list(3, 4)))
Condition
Error in `fn()`:
Error:
! Can't combine `x` <character> and `y` <integer>.

0 comments on commit d9584df

Please sign in to comment.