Skip to content

Conversation

@DavisVaughan
Copy link
Member

Closes #2012

Both feisr and merTools break with dev vctrs. They both try to call list_unchop() with a list array.

Internally we assume that if obj_is_list() is true, then r_length(x) == vec_size(x) and are interchangeable. This is what broke list_unchop() for these two packages. We switched to vec_size() instead of r_length() in the C code after a call to obj_check_list()

vctrs/src/list-combine.c

Lines 291 to 294 in e1c3308

obj_check_list(xs, p_xs_arg, error_call);
r_obj* const* v_xs = r_list_cbegin(xs);
r_ssize xs_size = vec_size(xs);

It's not clear what list_unchop() should even do with a list array. It's also not clear for functions like list_drop_empty(), where the output is unconditionally an atomic list vector. I'd argue that most vctrs list_*() functions that check their input with obj_is_list() are not prepared for list arrays, so obj_is_list() should simply return FALSE on them.

So the example from #2012 no longer silently succeeds with an incorrect answer, but instead returns a clear failure of:

library(vctrs)

xs <- list(
  data.frame(x = 1:2, y = 1:2),
  data.frame(x = 3:4, y = 3:4),
  data.frame(x = 4:5, y = 4:5)
)
dim(xs) <- c(1, 3)

dplyr::bind_rows(xs)
#> Error in `list_flatten()`:
#> ! `x` must be a list, not a list matrix.

@DavisVaughan DavisVaughan merged commit 662be44 into main Dec 5, 2025
13 checks passed
@DavisVaughan DavisVaughan deleted the feature/obj-is-list branch December 5, 2025 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deal with feisr breaking change

2 participants