Fix/Implement empty type constraint handling (fixes #133)
parent
b219a23684
commit
b43ee43220
|
@ -587,3 +587,15 @@ alternatives = -- a
|
||||||
<|> alterantiveTwo -- d
|
<|> alterantiveTwo -- d
|
||||||
<|> alternativeThree -- e
|
<|> alternativeThree -- e
|
||||||
) -- f
|
) -- f
|
||||||
|
|
||||||
|
#test issue 133
|
||||||
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
func
|
||||||
|
:: forall a
|
||||||
|
. ()
|
||||||
|
=> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
-> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
func
|
||||||
|
:: ()
|
||||||
|
=> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
-> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
|
|
@ -47,7 +47,7 @@ layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
t <- lrdrNameToTextAnn name
|
t <- lrdrNameToTextAnn name
|
||||||
docWrapNode name $ docLit t
|
docWrapNode name $ docLit t
|
||||||
#endif
|
#endif
|
||||||
HsForAllTy bndrs (L _ (HsQualTy (L _ cntxts@(_:_)) typ2)) -> do
|
HsForAllTy bndrs (L _ (HsQualTy (L _ cntxts) typ2)) -> do
|
||||||
typeDoc <- docSharedWrapper layoutType typ2
|
typeDoc <- docSharedWrapper layoutType typ2
|
||||||
tyVarDocs <- bndrs `forM` \case
|
tyVarDocs <- bndrs `forM` \case
|
||||||
(L _ (UserTyVar name)) -> return $ (lrdrNameToText name, Nothing)
|
(L _ (UserTyVar name)) -> return $ (lrdrNameToText name, Nothing)
|
||||||
|
@ -90,6 +90,7 @@ layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
contextDoc = case cntxtDocs of
|
contextDoc = case cntxtDocs of
|
||||||
|
[] -> docLit $ Text.pack "()"
|
||||||
[x] -> x
|
[x] -> x
|
||||||
_ -> docAlt
|
_ -> docAlt
|
||||||
[ let
|
[ let
|
||||||
|
@ -210,13 +211,12 @@ layoutType ltype@(L _ typ) = docWrapNode ltype $ case typ of
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
(HsQualTy (L _ []) _) ->
|
HsQualTy lcntxts@(L _ cntxts) typ1 -> do
|
||||||
briDocByExactInlineOnly "HsQualTy [] _" ltype
|
|
||||||
HsQualTy lcntxts@(L _ cntxts@(_:_)) typ1 -> do
|
|
||||||
typeDoc <- docSharedWrapper layoutType typ1
|
typeDoc <- docSharedWrapper layoutType typ1
|
||||||
cntxtDocs <- cntxts `forM` docSharedWrapper layoutType
|
cntxtDocs <- cntxts `forM` docSharedWrapper layoutType
|
||||||
let
|
let
|
||||||
contextDoc = docWrapNode lcntxts $ case cntxtDocs of
|
contextDoc = docWrapNode lcntxts $ case cntxtDocs of
|
||||||
|
[] -> docLit $ Text.pack "()"
|
||||||
[x] -> x
|
[x] -> x
|
||||||
_ -> docAlt
|
_ -> docAlt
|
||||||
[ let
|
[ let
|
||||||
|
|
Loading…
Reference in New Issue