Fix imports of type operators. #171

Merged
ChickenProp merged 1 commits from fix-type-operator-imports into master 2018-08-19 15:20:06 +02:00
3 changed files with 10 additions and 7 deletions

View File

@ -727,6 +727,9 @@ import Test ( T
, T5(T5, t5)
, T6((<|>))
, (+)
, (:.)
, (:.)(..)
, (:.)(T7, (:.), t7)
)
#test hiding

View File

@ -79,4 +79,5 @@ module Test (type (++), (++), pattern Foo) where
import Test ( type (++)
, (++)
, pattern Foo
, pattern (:.)
)

View File

@ -41,19 +41,19 @@ layoutIE :: ToBriDoc IE
layoutIE lie@(L _ ie) = docWrapNode lie $ case ie of
IEVar x -> layoutWrapped lie x
IEThingAbs x -> layoutWrapped lie x
IEThingAll _ -> docSeq [ienDoc, docLit $ Text.pack "(..)"]
IEThingWith _ (IEWildcard _) _ _ ->
docSeq [ienDoc, docLit $ Text.pack "(..)"]
IEThingWith _ _ ns _ -> do
IEThingAll x -> docSeq [layoutWrapped lie x, docLit $ Text.pack "(..)"]
IEThingWith x (IEWildcard _) _ _ ->
docSeq [layoutWrapped lie x, docLit $ Text.pack "(..)"]
IEThingWith x _ ns _ -> do
hasComments <- hasAnyCommentsBelow lie
runFilteredAlternative $ do
addAlternativeCond (not hasComments)
$ docSeq
$ [ienDoc, docLit $ Text.pack "("]
$ [layoutWrapped lie x, docLit $ Text.pack "("]
++ intersperse docCommaSep (map nameDoc ns)
++ [docParenR]
addAlternative $ docAddBaseY BrIndentRegular $ docPar
ienDoc
(layoutWrapped lie x)
(layoutItems (splitFirstLast ns))
where
nameDoc = (docLit =<<) . lrdrNameToTextAnn . prepareName
@ -75,7 +75,6 @@ layoutIE lie@(L _ ie) = docWrapNode lie $ case ie of
]
_ -> docEmpty
where
ienDoc = docLit =<< lrdrNameToTextAnn (ieName <$> lie)
#if MIN_VERSION_ghc(8,2,0) /* ghc-8.2, 8.4, .. */
layoutWrapped _ = \case
L _ (IEName n) -> docLit =<< lrdrNameToTextAnn n