Skip to content

Conversation

@DavisVaughan
Copy link
Member

@DavisVaughan DavisVaughan commented Dec 17, 2025

Closes #2127
Closes #1981

The goal of this PR was to fix this small x_type -> y_type typo here

return vec_ptype_or_s3_fallback(y, p_y_arg, x_type, call, s3_fallback);

But since that is run as the very first iteration of almost every vec_ptype_common() call (because we start the reduction with x = NULL, y = xs[[1]]), it had a huge amount of fallout of weird buggy cases that relied on this.

I think pretty much every change I had to make was a net improvement. The sf commit was particularly complicated though.

One other meaningful change is that I've added vec_ptype.POSIXlt(), which returns a corresponding POSIXct, so that vec_ptype_common(<POSIXlt>) and vec_ptype_common(<POSIXlt>, <POSIXlt>) consistently return a POSIXct, which has implications for vec_c(x) and vec_c(x, x) as well (now both return POSIXct).

Best to look at these commits one at a time.

This matters now because changing `x_type` to `y_type` means that `vec_ptype2(x, x)` is now being called on `POSIXlt` in `vec_c()` and friends instead of `vec_ptype(x)`. This should not have mattered, but they returned different results (ptype kept POSIXlt, ptype2 changed to POSIXct). I've fixed this inconsistency by pushing ptype towards POSIXct as well, which feels right.
`vec_ptype2(foobar(1:3), foobar(1:3))` which returns a `<quux>`, and then `vec_ptype2(<quux>, foobar(4L))`
It would work if you register the other half of the old-style `vec_ptype2()` self-self method, but I can't figure out how to register the old-style `vec_ptype2.vctrs_implements_ptype2_true` generic, and it doesn't feel worth it to keep this.
This is what previously failed with `x_ptype` instead of `y_ptype`
@DavisVaughan DavisVaughan requested a review from lionel- December 17, 2025 21:10
It hardcodes the `tzone` to `"UTC"` rather than using `""` like we intended
@DavisVaughan
Copy link
Member Author

DavisVaughan commented Dec 19, 2025

There are unfortunately more revdep failures we are going to have to deal with from this

Some related to POSIXlt going towards POSIXct more often. Some related to ptype2 being called more often, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants