Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion R/import-standalone-types-check.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion R/theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was likely a bug but it was apparently never triggered.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! It is for an interaction with extensions, which is hard to properly test

if (is_subclass) {
new <- defaults(e1, e2)
e2[names(new)] <- new
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-layer.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down