From 849d5414226b9f97ba74bc90e4ff5b7e46bd20cd Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Wed, 21 May 2025 15:33:50 +0200 Subject: [PATCH 1/2] init --- R/import-standalone-types-check.R | 2 +- R/theme.R | 2 +- tests/testthat/test-layer.R | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/import-standalone-types-check.R b/R/import-standalone-types-check.R index ef8c5a1d5e..2caa540649 100644 --- a/R/import-standalone-types-check.R +++ b/R/import-standalone-types-check.R @@ -476,7 +476,7 @@ check_character <- function(x, if (!missing(x)) { if (is_character(x)) { - if (!allow_na && any(is.na(x))) { + if (!allow_na && anyNA(x)) { abort( sprintf("`%s` can't contain NA values.", arg), arg = arg, diff --git a/R/theme.R b/R/theme.R index 34b82d0f96..7f6c1b93fd 100644 --- a/R/theme.R +++ b/R/theme.R @@ -990,7 +990,7 @@ combine_elements <- function(e1, e2) { # If e2 is 'richer' than e1, fill e2 with e1 parameters is_subclass <- !any(inherits(e2, class(e1), which = TRUE) == 0) - is_subclass <- is_subclass && length(setdiff(class(e2), class(e1)) > 0) + is_subclass <- is_subclass && length(setdiff(class(e2), class(e1))) > 0 if (is_subclass) { new <- defaults(e1, e2) e2[names(new)] <- new diff --git a/tests/testthat/test-layer.R b/tests/testthat/test-layer.R index 0c65c430df..23d7ef5ed6 100644 --- a/tests/testthat/test-layer.R +++ b/tests/testthat/test-layer.R @@ -148,10 +148,10 @@ test_that("layer warns for constant aesthetics", { test_that("layer names can be resolved", { p <- ggplot() + geom_point() + geom_point() - expect_equal(names(p$layers), c("geom_point", "geom_point...2")) + expect_named(p$layers, c("geom_point", "geom_point...2")) p <- ggplot() + geom_point(name = "foo") + geom_point(name = "bar") - expect_equal(names(p$layers), c("foo", "bar")) + expect_named(p$layers, c("foo", "bar")) l <- geom_point(name = "foobar") expect_snapshot(p + l + l, error = TRUE) From fa600d69b603afd15117404b6638735819afcc25 Mon Sep 17 00:00:00 2001 From: etiennebacher Date: Wed, 21 May 2025 15:38:22 +0200 Subject: [PATCH 2/2] revert change in import-standalone --- R/import-standalone-types-check.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/import-standalone-types-check.R b/R/import-standalone-types-check.R index 2caa540649..ef8c5a1d5e 100644 --- a/R/import-standalone-types-check.R +++ b/R/import-standalone-types-check.R @@ -476,7 +476,7 @@ check_character <- function(x, if (!missing(x)) { if (is_character(x)) { - if (!allow_na && anyNA(x)) { + if (!allow_na && any(is.na(x))) { abort( sprintf("`%s` can't contain NA values.", arg), arg = arg,