Skip to content

Strip srcref from the $constructor expression #6472

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yjunechoe
Copy link
Contributor

Fixes #6467 - layer expression shows up correctly on print

p_expr <- parse(text = "
  p <- ggplot() +
    geom_point(size = 5)
")
eval(p_expr)

p$layers[[1]]$constructor
#> geom_point(size = 5)

I don't think I see existing tests for $constructor and this is only a minor display change, but if we were to add a test for the PR it'd be something like:

expect_identical(
  capture.output(p$layers[[1]]$constructor),
  "geom_point(size = 5)"
)

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.

layer()$constructor can be misleading
1 participant