Skip to content

Fix some lints #6470

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

Merged
merged 2 commits into from
May 22, 2025
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
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