Skip to content
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

Fallback for check_subclass() #6119

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Collaborator

This PR aims to progress #5962 and #3798.

Taking the deprecation of GeomCol (#3798) as an example, we want users to be able to use layer(geom = "col", ...) even after the class is deprecated. This PR ensures that layer(geom = "col") finds the geom_col() constructor and returns the geom field from the resulting layer (even if we remove the GeomCol class).

name <- snakeize(name)
obj <- find_global(name, env = env, mode = "function")
if (is.function(obj)) {
obj <- obj()
Copy link
Member

Choose a reason for hiding this comment

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

Maybe wrap in try_fetch() and rethrow the error with some additional context. We might end in situations where the constructor can't be called without arguments even though it generally should work

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.

2 participants