Fix layout of type-level list literal
parent
84e703d7f3
commit
2b77142617
|
@ -72,3 +72,9 @@ test
|
|||
True]
|
||||
test = Proxy @'[{- comment -}
|
||||
True]
|
||||
|
||||
#test explicit-list-type non-promoted
|
||||
type Foo = '[Bool, Bool, Bool]
|
||||
|
||||
#test explicit-list-type promoted
|
||||
type Foo = '[ 'Bool, Bool, Bool ]
|
||||
|
|
|
@ -443,12 +443,7 @@ layoutType ltype@(L _ typ) = docHandleComms ltype $ case typ of
|
|||
|
||||
typDocs <- typs `forM` (shareDoc . docHandleListElemComms layoutType)
|
||||
let hasComments = hasAnyCommentsBelow ltype
|
||||
docAlt
|
||||
[ docSeq
|
||||
$ [docLit $ Text.pack "'[", sepIfHeadPromoted]
|
||||
++ List.intersperse specialCommaSep (docForceSingleline <$> typDocs)
|
||||
++ [sepIfHeadPromoted, docLit $ Text.pack "]"]
|
||||
, case splitFirstLast typDocs of
|
||||
case splitFirstLast typDocs of
|
||||
FirstLastEmpty -> docSeq
|
||||
[ docLit $ Text.pack "'[]" -- TODO92 comments AnnOpenS
|
||||
]
|
||||
|
@ -474,11 +469,11 @@ layoutType ltype@(L _ typ) = docHandleComms ltype $ case typ of
|
|||
$ docSeq
|
||||
$ [docLit $ Text.pack "'[", sepIfHeadPromoted]
|
||||
++ List.intersperse
|
||||
specialCommaSep
|
||||
docCommaSep
|
||||
(docForceSingleline
|
||||
<$> (e1 : ems ++ [eN]) -- TODO92 comments AnnOpenS
|
||||
)
|
||||
++ [docLit $ Text.pack " ]"]
|
||||
++ [sepIfHeadPromoted, docLit $ Text.pack "]"]
|
||||
addAlternative
|
||||
$ let
|
||||
start = docCols ColList [appSep $ docLit $ Text.pack "'[", e1]
|
||||
|
@ -488,7 +483,6 @@ layoutType ltype@(L _ typ) = docHandleComms ltype $ case typ of
|
|||
[specialCommaSep, eN] -- TODO92 comments AnnOpenS
|
||||
end = docLit $ Text.pack " ]"
|
||||
in docSetBaseY $ docLines $ [start] ++ linesM ++ [lineN] ++ [end]
|
||||
]
|
||||
HsExplicitTupleTy{} -> -- TODO
|
||||
briDocByExactInlineOnly "HsExplicitTupleTy{}" ltype
|
||||
HsTyLit _ lit -> case lit of
|
||||
|
|
Loading…
Reference in New Issue