mirror of
https://github.com/google/ormolu.git
synced 2024-10-26 08:31:36 +03:00
Use braces when placing $
on the same line
This commit is contained in:
parent
cd6c7521c1
commit
81e60bb342
@ -16,3 +16,7 @@ foo =
|
||||
bar
|
||||
$ baz
|
||||
$ quux
|
||||
|
||||
x =
|
||||
case l of { A -> B } $
|
||||
case q of r -> s
|
||||
|
@ -16,3 +16,7 @@ foo =
|
||||
bar
|
||||
$ baz
|
||||
$ quux
|
||||
|
||||
x =
|
||||
case l of { A -> B } $
|
||||
case q of r -> s
|
||||
|
@ -1259,21 +1259,24 @@ p_exprOpTree isDollarSpecial s (OpBranch x op y) = do
|
||||
gotDollar = case getOpName (unLoc op) of
|
||||
Just rname -> mkVarOcc "$" == (rdrNameOcc rname)
|
||||
_ -> False
|
||||
switchLayout [opTreeLoc x]
|
||||
$ ub
|
||||
$ p_exprOpTree (not gotDollar) s x
|
||||
lhs =
|
||||
switchLayout [opTreeLoc x] $
|
||||
p_exprOpTree (not gotDollar) s x
|
||||
let p_op = located op (opWrapper . p_hsExpr)
|
||||
p_y = switchLayout [opTreeLoc y] (p_exprOpTree True N y)
|
||||
if isDollarSpecial && gotDollar && placement == Normal && isOneLineSpan (opTreeLoc x)
|
||||
then do
|
||||
useBraces lhs
|
||||
space
|
||||
p_op
|
||||
breakpoint
|
||||
inci p_y
|
||||
else placeHanging placement $ do
|
||||
p_op
|
||||
space
|
||||
p_y
|
||||
else do
|
||||
ub lhs
|
||||
placeHanging placement $ do
|
||||
p_op
|
||||
space
|
||||
p_y
|
||||
|
||||
-- | Get annotations for the enclosing element.
|
||||
getEnclosingAnns :: R [AnnKeywordId]
|
||||
|
Loading…
Reference in New Issue
Block a user