Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to rlang 1.0.4 and vctrs 0.4.1 #297

Merged
merged 2 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
3 changes: 2 additions & 1 deletion R/duration.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion R/naive-time.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,14 @@
(expect_error(calendar_count_between(x, x, "year", n = 1.5)))
Output
<error/vctrs_error_cast_lossy>
Error in `stop_vctrs()`:
Error in `calendar_count_between()`:
! Can't convert from `n` <double> to <integer> due to loss of precision.
* Locations: 1
Code
(expect_error(calendar_count_between(x, x, "year", n = "x")))
Output
<error/vctrs_error_incompatible_type>
Error in `stop_vctrs()`:
Error in `calendar_count_between()`:
! Can't convert `n` <character> to <integer>.
Code
(expect_error(calendar_count_between(x, x, "year", n = c(1L, 2L))))
Expand Down
6 changes: 2 additions & 4 deletions tests/testthat/_snaps/date.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,11 @@

# validates integerish `by`

Can't convert from `by` <double> to <integer> due to loss of precision.
* Locations: 1
Can't convert `by` <double> to <integer>.

# validates `total_size` early

Can't convert from `total_size` <double> to <integer> due to loss of precision.
* Locations: 1
Can't convert `total_size` <double> to <integer>.

---

Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/_snaps/duration.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@

# can't convert calendrical duration to time point

Can't combine <duration<year>> and <duration<day>>.
Can't combine `x` <duration<year>> and <duration<day>>.
Can't combine calendrical durations with chronological durations.

---

Can't combine <duration<year>> and <duration<day>>.
Can't combine `x` <duration<year>> and <duration<day>>.
Can't combine calendrical durations with chronological durations.

# precision: can only be called on durations
Expand All @@ -183,7 +183,7 @@
(expect_error(duration_years(1) / duration_years(2)))
Output
<error/vctrs_error_incompatible_op>
Error in `stop_vctrs()`:
Error in `vec_arith()`:
! <duration<year>> / <duration<year>> is not permitted
Durations only support integer division. Did you want `%/%`?

Expand All @@ -209,7 +209,7 @@
(expect_error(duration_hours(5) %% 2.5))
Output
<error/vctrs_error_cast_lossy>
Error in `stop_vctrs()`:
Error in `duration_scalar_arith()`:
! Can't convert from `y` <double> to <integer> due to loss of precision.
* Locations: 1

6 changes: 2 additions & 4 deletions tests/testthat/_snaps/posixt.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,11 @@

# validates integerish `by`

Can't convert from `by` <double> to <integer> due to loss of precision.
* Locations: 1
Can't convert `by` <double> to <integer>.

# validates `total_size` early

Can't convert from `total_size` <double> to <integer> due to loss of precision.
* Locations: 1
Can't convert `total_size` <double> to <integer>.

---

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/sys-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---
Expand All @@ -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.

---
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/time-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
(expect_error(time_point_count_between(x, y)))
Output
<error/vctrs_error_incompatible_type>
Error in `stop_vctrs()`:
Error in `time_point_count_between()`:
! Can't combine `start` <time_point<sys><day>> and `end` <time_point<naive><day>>.

# `n` is validated
Expand All @@ -181,14 +181,14 @@
(expect_error(time_point_count_between(x, x, "day", n = 1.5)))
Output
<error/vctrs_error_cast_lossy>
Error in `stop_vctrs()`:
Error in `time_point_count_between()`:
! Can't convert from `n` <double> to <integer> due to loss of precision.
* Locations: 1
Code
(expect_error(time_point_count_between(x, x, "day", n = "x")))
Output
<error/vctrs_error_incompatible_type>
Error in `stop_vctrs()`:
Error in `time_point_count_between()`:
! Can't convert `n` <character> to <integer>.
Code
(expect_error(time_point_count_between(x, x, "day", n = c(1L, 2L))))
Expand Down