Make inheritance error more informative
Closed this issue · 3 comments
yjunechoe commented
> ggtrace_inspect_n(p, StatCount$compute_panel)
Error:
! Method 'compute_panel' is not defined for `StatCount`
Check inheritance with `get_method(StatCount$compute_panel, inherit = TRUE)`
Should be more like:
> ggtrace_inspect_n(p, StatCount$compute_panel)
Error:
! Method 'compute_panel' is not defined for `StatCount`
Did you mean the inherited method `Stat$compute_panel`?
Requires distinguishing between inherited-not-defined vs. not-defined
yjunechoe commented
Or ... make it a warning not an error; just grab the right method internally and say so
Balances the goal of making people learn how ggproto works through exposure but also not make the function require knowledge about ggproto
yjunechoe commented
Actually that can lead to odd behavior, like inspecting StatBoxplot$compute_layer
will work in geom_bar()
b/c it fetches Stat$compute_layer
which StatCount
also inherits ...