reprex
reprex copied to clipboard
Parse error when braces are on a separate line
When braces are on a separate line (see the suppressWarnings() difference where braces are on the same line vs. different lines at the top), reprex can generate a parse error:
The first example fails to parse with the error:
i Rendering reprex...
Error in parse(text = x, keep.source = TRUE) :
<text>:11:3: unexpected symbol
10: rlang::warn("show this")
11: rlang
^
reprex::reprex({
rlang::warn("show this")
rlang::warn("hide this", class="hider")
suppressWarnings(
{
rlang::warn("show this")
rlang::warn("hide this", class="hider")
},
classes="hider")
})
The second example where the { is on the same line as suppressWarnings( succeeds:
rlang::warn("show this")
#> Warning: show this
rlang::warn("hide this", class="hider")
#> Warning: hide this
suppressWarnings({
rlang::warn("show this")
rlang::warn("hide this", class="hider")
},
classes="hider")
#> Warning: show this
Created on 2021-08-01 by the reprex package (v2.0.0)