Skip to content

Accept legacy mappings reclassed as uneval - #6934

Draft
t-kalinowski wants to merge 1 commit into
tidyverse:mainfrom
t-kalinowski:fix/legacy-uneval-mappings
Draft

t-kalinowski wants to merge 1 commit into
tidyverse:mainfrom
t-kalinowski:fix/legacy-uneval-mappings

Conversation

@t-kalinowski

Copy link
Copy Markdown
Contributor

CRAN failure

After the S7 1.0.0 upgrade, the ggforce 0.5.0 examples fail when geom_autodensity() passes a reclassed mapping to ggplot2. CRAN check results

Error in `geom_autodensity()`:
! `mapping` must be created by `aes()`.
✖ You've supplied an <uneval> object.

Reproduction

library(ggplot2)

mapping <- aes(mpg, wt)
class(mapping) <- "uneval"
p <- ggplot(mtcars, mapping) + geom_point()
nrow(get_layer_data(p))

Before and after

With S7 1.0.0, the base branch raises the same mapping error. With this change, the plot builds and the example returns 32 rows. All 15 reported mapping failures also pass their targeted reproductions with this branch and S7 1.0.0.9000.

Replacing the class vector leaves S7 metadata attached, so the unqualified S7 inheritance check skips the legacy conversion. Check whether the object is already a ggplot2 mapping before deciding whether to rebuild an uneval list with aes(). The regression test covers mappings passed to both ggplot() and geom_point().

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant