Fix import-hiding-paragraph with policy/=free (fixes #150)

pull/153/head
Lennart Spitzner 2018-06-04 17:30:50 +02:00
parent 6725d0e119
commit 5816704658
3 changed files with 39 additions and 5 deletions

View File

@ -734,6 +734,21 @@ import Test hiding ( )
import Test as T
hiding ( )
#test import-hiding-many
import Prelude as X
hiding ( head
, init
, last
, maximum
, minimum
, pred
, read
, readFile
, succ
, tail
, undefined
)
#test long-module-name-simple
import TestJustShortEnoughModuleNameLikeThisOne ( )
import TestJustAbitToLongModuleNameLikeThisOneIs

View File

@ -736,6 +736,22 @@ import Test (T, T2(), T3(..), T4(T4), T5(T5, t5), T6((<|>)), (+))
import Test hiding ()
import Test as T hiding ()
#test import-hiding-many
import Prelude as X
hiding
( head
, init
, last
, maximum
, minimum
, pred
, read
, readFile
, succ
, tail
, undefined
)
#test long-module-name-simple
import TestJustShortEnoughModuleNameLikeThisOne ()
import TestJustAbitToLongModuleNameLikeThisOneIs ()

View File

@ -87,7 +87,10 @@ layoutImport limportD@(L _ importD) = docWrapNode limportD $ case importD of
Just (_, llies) -> do
hasComments <- hasAnyCommentsBelow llies
if compact
then docSeq [hidDoc, layoutLLIEs True llies]
then docAlt
[ docSeq [hidDoc, docForceSingleline $ layoutLLIEs True llies]
, docPar hidDoc (layoutLLIEs True llies)
]
else do
ieDs <- layoutAnnAndSepLLIEs llies
docWrapNodeRest llies
@ -99,7 +102,7 @@ layoutImport limportD@(L _ importD) = docWrapNode limportD $ case importD of
(docSeq [hidDoc, docParenLSep, docWrapNode llies docEmpty])
(docEnsureIndent (BrIndentSpecial hidDocColDiff) docParenR)
else docSeq [hidDoc, docParenLSep, docSeparator, docParenR]
-- ..[hiding].( b )
-- ..[hiding].( b )
[ieD] -> runFilteredAlternative $ do
addAlternativeCond (not hasComments)
$ docSeq
@ -112,9 +115,9 @@ layoutImport limportD@(L _ importD) = docWrapNode limportD $ case importD of
addAlternative $ docPar
(docSeq [hidDoc, docParenLSep, docNonBottomSpacing ieD])
(docEnsureIndent (BrIndentSpecial hidDocColDiff) docParenR)
-- ..[hiding].( b
-- , b'
-- )
-- ..[hiding].( b
-- , b'
-- )
(ieD:ieDs') ->
docPar
(docSeq [hidDoc, docSetBaseY $ docSeq [docParenLSep, ieD]])