Skip to content

Commit e44cd18

Browse files
committed
Revert "Be more conservative in omitting warning"
This reverts commit 734bb0c.
1 parent 064948e commit e44cd18

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

R/utilities.r

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -628,19 +628,13 @@ with_ordered_restart <- function(expr, .call) {
628628
class_y <- class(y)[1]
629629

630630
restart <- FALSE
631-
warn <- TRUE
632-
two_ordered <- FALSE
633631

634632
if (is.ordered(x) || is.ordered(y)) {
635633
restart <- TRUE
636-
x_is_ordered <- is.ordered(x)
637-
y_is_ordered <- is.ordered(y)
638-
# Check whether vec_cast should emit warning
639-
two_ordered <- x_is_ordered && y_is_ordered
640-
if (x_is_ordered) {
634+
if (is.ordered(x)) {
641635
x <- factor(as.character(x), levels = levels(x))
642636
}
643-
if (y_is_ordered) {
637+
if (is.ordered(y)) {
644638
y <- factor(as.character(y), levels = levels(y))
645639
}
646640
} else if (is.character(x) || is.character(y)) {
@@ -674,11 +668,8 @@ with_ordered_restart <- function(expr, .call) {
674668
format_error_call(.call),
675669
")"
676670
)
677-
if (inherits(cnd, "vctrs_error_cast")) {
678-
# Should be FALSE when vec_ptype2 has seen two ordered factors
679-
warn <- attr(y, "warn") %||% TRUE
680-
}
681-
if (warn) {
671+
672+
if (inherits(cnd, "vctrs_error_ptype2")) {
682673
deprecate_soft0(
683674
"3.4.0",
684675
I(msg),
@@ -693,8 +684,6 @@ with_ordered_restart <- function(expr, .call) {
693684
# Recurse with factor methods and restart with the result
694685
if (inherits(cnd, "vctrs_error_ptype2")) {
695686
out <- vec_ptype2(x, y, x_arg = x_arg, y_arg = y_arg, call = call)
696-
# Set warn attribute to forward to vec_cast
697-
attr(out, "warn") <- !two_ordered
698687
restart <- "vctrs_restart_ptype2"
699688
} else if (inherits(cnd, "vctrs_error_cast")) {
700689
out <- vec_cast(x, y, x_arg = x_arg, to_arg = y_arg, call = call)

0 commit comments

Comments
 (0)