Created attachment 2324 [details]
Fix deparsing of ! calls
Currently `deparse(quote(!!x))` yields "!(!x)". This is problematic
because reparsing that code gives a different parse tree. This patch
ensures that `!` calls are parsed and reparsed exactly by deparsing
quote(!!x) to "!!x".
The new behaviour is also consistent with deparsing of unary `+`, `-`
and `~` calls. The latter follow another code path because their
PPkind is PP_BINARY so the parenthesis added in the `!` case can be
explained as an oversight.
For consistency I also meant to adjust the deparser so that
`deparse(quote(??x))` yields "??x" rather than "`?`(`?`(x))" but to do
this cleanly would require adding `?` to the R_FunTab, adjust the
PPprec enum, etc. Since the deparsed code with backticks at least
reparses correctly, it didn't seem worth the trouble. Let me know if
you'd like another patch to make `?` deparsing consistent though.
Agreed that this is a buglet.
Your fix (with slightly more comments in the regression checks) committed to
R-devel. .... may still make it into R 3.5.0