And one more touch to ExplicitList
parent
ca42178eff
commit
c3dc3b6074
|
@ -761,6 +761,13 @@ autocheckCases =
|
|||
)
|
||||
]
|
||||
|
||||
#test issue 18c
|
||||
func =
|
||||
[ (abc, (1111, 1111))
|
||||
, (def, (2, 2))
|
||||
, foo -- comment
|
||||
]
|
||||
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
@ -770,8 +777,6 @@ autocheckCases =
|
|||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
|
||||
|
||||
## this testcase is not about idempotency, but about _how_ the output differs
|
||||
## from the input; i cannot really express this yet with the current
|
||||
## test-suite.
|
||||
|
|
|
@ -574,6 +574,7 @@ layoutExpr lexpr@(L _ expr) = docWrapNode lexpr $ case expr of
|
|||
unknownNodeError "HsDo{} no comp" lexpr
|
||||
ExplicitList _ _ elems@(_:_) -> do
|
||||
elemDocs <- elems `forM` docSharedWrapper layoutExpr
|
||||
hasComments <- hasAnyCommentsBelow lexpr
|
||||
case splitFirstLast elemDocs of
|
||||
FirstLastEmpty -> docSeq
|
||||
[ docLit $ Text.pack "["
|
||||
|
@ -594,12 +595,14 @@ layoutExpr lexpr@(L _ expr) = docWrapNode lexpr $ case expr of
|
|||
]
|
||||
]
|
||||
FirstLast e1 ems eN ->
|
||||
docAlt
|
||||
[ docSeq
|
||||
docAltFilter
|
||||
[ (,) (not hasComments)
|
||||
$ docSeq
|
||||
$ [docLit $ Text.pack "["]
|
||||
++ List.intersperse docCommaSep (docForceSingleline <$> (e1:ems ++ [docNodeAnnKW lexpr (Just AnnOpenS) eN]))
|
||||
++ [docLit $ Text.pack "]"]
|
||||
, let
|
||||
, (,) True
|
||||
$ let
|
||||
start = docCols ColList
|
||||
[appSep $ docLit $ Text.pack "[", e1]
|
||||
linesM = ems <&> \d ->
|
||||
|
|
Loading…
Reference in New Issue