fn bare_prefix_operand_needs_parens<T: AstInfo>(operand: &Expr<T>) -> boolExpand description
Whether the operand of a bare prefix -/+ must be parenthesized to
round-trip. Such a prefix op binds tighter than COLLATE/AT TIME ZONE
and the binary/comparison operators, but looser than the postfix
::/[…] forms, and - <number> additionally lexes as a negative literal.
So peel the tight postfixes (::/[…]). If the chain bottoms out at a
numeric literal, the sign would fold into it, and if it bottoms out at
anything other than a self-delimiting non-COLLATE primary (a COLLATE, a
binary op, …), the prefix op would re-associate. Both need parens.
(a + b COLLATE c reparses as a + (b COLLATE c), and - x COLLATE c as
(- x) COLLATE c.)