on master help sign in
Also add parentheses around TH-quoted qualified operators
46a1c22mrkkrp
data/examples/declaration/splice/quotes-out.hs+2
@@ -3,3 +3,5 @@ foo = ''R
3bar = 'foo
3bar = 'foo
4
4
5baz = ''(:#)
5baz = ''(:#)
6+
7+baz' = ''(Foo.Bar.:#)
data/examples/declaration/splice/quotes.hs+2
@@ -3,3 +3,5 @@ foo = ''R
3bar = 'foo
3bar = 'foo
4
4
5baz = ''(:#)
5baz = ''(:#)
6+
7+baz' = ''(Foo.Bar.:#)
src/Ormolu/Printer/Meat/Declaration/Value.hs+2−2
@@ -14,7 +14,7 @@ import Bag (bagToList)
14import BasicTypes
14import BasicTypes
15import Control.Monad
15import Control.Monad
16import Data.Bool (bool)
16import Data.Bool (bool)
17−import Data.Char (isAlphaNum)
17+import Data.Char (isPunctuation)
18import Data.Data hiding (Infix, Prefix)
18import Data.Data hiding (Infix, Prefix)
19import Data.List (intersperse, sortOn)
19import Data.List (intersperse, sortOn)
20import Data.Text (Text)
20import Data.Text (Text)
@@ -810,7 +810,7 @@ p_hsBracket = \case
810 -- turn makes it impossible to detect if there are parentheses around
810 -- turn makes it impossible to detect if there are parentheses around
811 -- it, etc. So we have to add parentheses manually assuming they are
811 -- it, etc. So we have to add parentheses manually assuming they are
812 -- necessary for all operators.
812 -- necessary for all operators.
813− let isOperator = not (any isAlphaNum (showOutputable name))
813+ let isOperator = any isPunctuation (showOutputable name)
814 wrapper = if isOperator then parens else id
814 wrapper = if isOperator then parens else id
815 wrapper $ p_rdrName (noLoc name)
815 wrapper $ p_rdrName (noLoc name)
816 TExpBr NoExt expr -> do
816 TExpBr NoExt expr -> do