tidyverse/ggplot2

Confusing error with circular ggproto definitions

Opened this issue · 0 comments

By accident you can sometimes try to circularly define a ggproto class.
Trying to do anything with the class will inevitably result in an error.
In the example below, printing will give the error:

library(ggplot2)

A <- ggproto("A")
A <- ggproto(NULL, A)
A
#> Error in `<current-expression>` : node stack overflow

I think this error could be caught and its message improved. From initial exploration, it seems we can do this in fetch_ggproto().