Compare commits

..

No commits in common. "22a658e794598ff893c63596b5ad289acc1eb8d9" and "34c8fd93d73dbf4a11f3dffbf314501bb5eb5393" have entirely different histories.

7 changed files with 183 additions and 226 deletions

View File

@ -998,20 +998,3 @@ func = do
func False = 0
-- comment
func True = 1
#test nested do-block-with-comment issue
dofunc = do
do
some
code
do
-- abc
more
code
#test do-block paren non-alignment
catchFunc = do
(func aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
)
`catch` catcher

View File

@ -379,18 +379,6 @@ hardcodedFixity allowUnqualify = \case
":>" -> fixity InfixL 9
":>=" -> fixity InfixL 9
":->" -> fixity InfixL 9
".==" -> fixity InfixN 5
"./" -> fixity InfixN 5
".<" -> fixity InfixN 5
".<=" -> fixity InfixN 5
".>" -> fixity InfixN 5
".>=" -> fixity InfixN 5
"`member`" -> fixity InfixN 8
"`notMember`" -> fixity InfixN 8
".//" -> fixity InfixL 4
".&&" -> fixity InfixR 3
".||" -> fixity InfixR 2
".=>" -> fixity InfixR 1
-- servant
":>" -> fixity InfixR 4

View File

@ -103,7 +103,7 @@ splitModuleDecls lmod = do
lastSpan <- do
finalYield $ MEExactModuleHead moduleWithoutComments
pure
$ maybe (0, 1) (ExactPrint.ss2posEnd)
$ maybe (1, 1) (ExactPrint.ss2posEnd)
$ maximumMay
$ [ GHC.anchor a
| L a _ <- GHC.priorComments $ case hsModAnn' of

View File

@ -245,8 +245,7 @@ layoutOpTree allowSinglelinePar = \case
wrapParenMlIf x innerHead innerLines = if x
then wrapParenMl innerHead innerLines
else docPar innerHead (docLines innerLines)
wrapParenMl innerHead innerLines = docAlt
[ docForceZeroAdd $ docSetBaseY $ docLines
wrapParenMl innerHead innerLines = docSetBaseY $ docLines
( [ docCols
ColOpPrefix
[ (if zeroOps then id else appSep) $ docLit $ Text.pack "("
@ -256,17 +255,6 @@ layoutOpTree allowSinglelinePar = \case
++ innerLines
++ [docHandleComms locC $ docLit $ Text.pack ")"]
)
, docPar
(docCols
ColOpPrefix
[ (if zeroOps then id else appSep) $ docLit $ Text.pack "("
, docHandleComms locO $ innerHead
]
)
( docLines
$ innerLines ++ [docHandleComms locC $ docLit $ Text.pack ")"]
)
]
configAllowsParInsert <- askLayoutConf _lconfig_fixityBasedAddAlignParens
let allowParIns = configAllowsParInsert && case fixity of

View File

@ -205,7 +205,7 @@ transformAlts =
let ind = _acp_indent acp + _acp_indentPrep acp + indAdd
mSet $ acp
{ _acp_indent = ind, _acp_indentPrep = 0
, _acp_indentPrepForced = parentForced
, _acp_indentPrepForced = False
}
sameLine' <- go sameLine
mModify $ \acp' -> acp'

View File

@ -91,8 +91,8 @@ transformSimplifyColumns = Uniplate.rewrite $ \case
]
BDPar ind col1@(BDCols sig1 _) col2@(BDCols sig2 _) | sig1 == sig2 ->
Just $ BDAddBaseY ind (BDLines [col1, col2])
-- BDPar ind col1@(BDCols sig1 _) (BDLines (col2@(BDCols sig2 _) : rest))
-- | sig1 == sig2 -> Just $ BDPar ind (BDLines [col1, col2]) (BDLines rest)
BDPar ind col1@(BDCols sig1 _) (BDLines (col2@(BDCols sig2 _) : rest))
| sig1 == sig2 -> Just $ BDPar ind (BDLines [col1, col2]) (BDLines rest)
BDPar ind (BDLines lines1) col2@(BDCols sig2 _)
| BDCols sig1 _ <- List.last lines1, sig1 == sig2 -> Just
$ BDAddBaseY ind (BDLines $ lines1 ++ [col2])

View File

@ -44,8 +44,6 @@ transformSimplifyIndent = Uniplate.rewrite $ \case
Just $ BDFlushCommentsPrior c (BDAddBaseY i x)
BDAddBaseY i (BDFlushCommentsPost c sm x) ->
Just $ BDFlushCommentsPost c sm (BDAddBaseY i x)
BDAddBaseY i (BDQueueComments comms x) ->
Just $ BDQueueComments comms (BDAddBaseY i x)
BDAddBaseY i (BDSeq l) ->
Just $ BDSeq $ List.init l ++ [BDAddBaseY i $ List.last l]
BDAddBaseY i (BDCols sig l) ->