From ab3e7747fbfe5bb96b9b7f917801045f1327133f Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Mon, 18 Jul 2022 11:38:46 -0400 Subject: [PATCH 1/2] Update to rlang 1.0.4 and vctrs 0.4.1 --- DESCRIPTION | 4 ++-- R/duration.R | 3 ++- R/naive-time.R | 3 ++- tests/testthat/_snaps/calendar.md | 4 ++-- tests/testthat/_snaps/date.md | 6 ++---- tests/testthat/_snaps/duration.md | 8 ++++---- tests/testthat/_snaps/posixt.md | 6 ++---- tests/testthat/_snaps/sys-time.md | 4 ++-- tests/testthat/_snaps/time-point.md | 6 +++--- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 147b872f..9aa55419 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -20,9 +20,9 @@ BugReports: https://github.com/r-lib/clock/issues Depends: R (>= 3.3) Imports: - rlang (>= 1.0.0), + rlang (>= 1.0.4), tzdb (>= 0.2.0), - vctrs (>= 0.3.7) + vctrs (>= 0.4.1) Suggests: covr, knitr, diff --git a/R/duration.R b/R/duration.R index 3422a988..129d13dc 100644 --- a/R/duration.R +++ b/R/duration.R @@ -312,7 +312,8 @@ as_sys_time.clock_duration <- function(x) { names <- clock_rcrd_names(x) # Promote to at least day precision for sys-time - x <- vec_cast(x, vec_ptype2(x, duration_days())) + ptype <- vec_ptype2(x, duration_days(), y_arg = "") + x <- vec_cast(x, ptype) precision <- duration_precision_attribute(x) diff --git a/R/naive-time.R b/R/naive-time.R index cbacd0c2..dab0c1d3 100644 --- a/R/naive-time.R +++ b/R/naive-time.R @@ -450,7 +450,8 @@ as_zoned_time.clock_naive_time <- function(x, zone <- zone_validate(zone) # Promote to at least seconds precision for `zoned_time` - x <- vec_cast(x, vec_ptype2(x, clock_empty_naive_time_second)) + ptype <- vec_ptype2(x, clock_empty_naive_time_second, y_arg = "") + x <- vec_cast(x, ptype) size <- vec_size(x) precision <- time_point_precision_attribute(x) diff --git a/tests/testthat/_snaps/calendar.md b/tests/testthat/_snaps/calendar.md index 12c8567c..6608e45d 100644 --- a/tests/testthat/_snaps/calendar.md +++ b/tests/testthat/_snaps/calendar.md @@ -214,14 +214,14 @@ (expect_error(calendar_count_between(x, x, "year", n = 1.5))) Output - Error in `stop_vctrs()`: + Error in `calendar_count_between()`: ! Can't convert from `n` to due to loss of precision. * Locations: 1 Code (expect_error(calendar_count_between(x, x, "year", n = "x"))) Output - Error in `stop_vctrs()`: + Error in `calendar_count_between()`: ! Can't convert `n` to . Code (expect_error(calendar_count_between(x, x, "year", n = c(1L, 2L)))) diff --git a/tests/testthat/_snaps/date.md b/tests/testthat/_snaps/date.md index 99ee13b8..8030e356 100644 --- a/tests/testthat/_snaps/date.md +++ b/tests/testthat/_snaps/date.md @@ -184,13 +184,11 @@ # validates integerish `by` - Can't convert from `by` to due to loss of precision. - * Locations: 1 + Can't convert `by` to . # validates `total_size` early - Can't convert from `total_size` to due to loss of precision. - * Locations: 1 + Can't convert `total_size` to . --- diff --git a/tests/testthat/_snaps/duration.md b/tests/testthat/_snaps/duration.md index e82fc682..0fe7326f 100644 --- a/tests/testthat/_snaps/duration.md +++ b/tests/testthat/_snaps/duration.md @@ -165,12 +165,12 @@ # can't convert calendrical duration to time point - Can't combine > and >. + Can't combine `x` > and >. Can't combine calendrical durations with chronological durations. --- - Can't combine > and >. + Can't combine `x` > and >. Can't combine calendrical durations with chronological durations. # precision: can only be called on durations @@ -183,7 +183,7 @@ (expect_error(duration_years(1) / duration_years(2))) Output - Error in `stop_vctrs()`: + Error in `vec_arith()`: ! > / > is not permitted Durations only support integer division. Did you want `%/%`? @@ -209,7 +209,7 @@ (expect_error(duration_hours(5) %% 2.5)) Output - Error in `stop_vctrs()`: + Error in `duration_scalar_arith()`: ! Can't convert from `y` to due to loss of precision. * Locations: 1 diff --git a/tests/testthat/_snaps/posixt.md b/tests/testthat/_snaps/posixt.md index 1a87f4f8..5df736ef 100644 --- a/tests/testthat/_snaps/posixt.md +++ b/tests/testthat/_snaps/posixt.md @@ -292,13 +292,11 @@ # validates integerish `by` - Can't convert from `by` to due to loss of precision. - * Locations: 1 + Can't convert `by` to . # validates `total_size` early - Can't convert from `total_size` to due to loss of precision. - * Locations: 1 + Can't convert `total_size` to . --- diff --git a/tests/testthat/_snaps/sys-time.md b/tests/testthat/_snaps/sys-time.md index 45dba0fb..3ba86061 100644 --- a/tests/testthat/_snaps/sys-time.md +++ b/tests/testthat/_snaps/sys-time.md @@ -22,7 +22,7 @@ Code sys_time_parse_RFC_3339(x, separator = 1) Condition - Error in `arg_match0()`: + Error in `sys_time_parse_RFC_3339()`: ! `separator` must be a string or character vector. --- @@ -38,7 +38,7 @@ Code sys_time_parse_RFC_3339(x, offset = 1) Condition - Error in `arg_match0()`: + Error in `sys_time_parse_RFC_3339()`: ! `offset` must be a string or character vector. --- diff --git a/tests/testthat/_snaps/time-point.md b/tests/testthat/_snaps/time-point.md index 9f9e0f20..d20d8642 100644 --- a/tests/testthat/_snaps/time-point.md +++ b/tests/testthat/_snaps/time-point.md @@ -160,7 +160,7 @@ (expect_error(time_point_count_between(x, y))) Output - Error in `stop_vctrs()`: + Error in `time_point_count_between()`: ! Can't combine `start` > and `end` >. # `n` is validated @@ -181,14 +181,14 @@ (expect_error(time_point_count_between(x, x, "day", n = 1.5))) Output - Error in `stop_vctrs()`: + Error in `time_point_count_between()`: ! Can't convert from `n` to due to loss of precision. * Locations: 1 Code (expect_error(time_point_count_between(x, x, "day", n = "x"))) Output - Error in `stop_vctrs()`: + Error in `time_point_count_between()`: ! Can't convert `n` to . Code (expect_error(time_point_count_between(x, x, "day", n = c(1L, 2L)))) From bcdabdbbd4d12a9a67b42c74e0cd7c6012d4f937 Mon Sep 17 00:00:00 2001 From: DavisVaughan Date: Mon, 18 Jul 2022 11:40:05 -0400 Subject: [PATCH 2/2] NEWS bullet --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 75723685..c9e338de 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # clock (development version) +* vctrs >=0.4.1 and rlang >=1.0.4 are now required (#297). + * Removed the dependency on ellipsis in favor of the equivalent functions in rlang (#288).