aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Interface/Specialize.hs
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2021-02-22 20:04:24 +0000
committerAlan Zimmerman <alan.zimm@gmail.com>2021-02-22 20:04:24 +0000
commit8241d9e700e043b86b609c334494c4632848389f (patch)
tree58cc739b2a3f9aa70c344a8c98994bd6c8b03172 /haddock-api/src/Haddock/Interface/Specialize.hs
parentd1b7f181b60ba3ac191183f1512e66793d28ac08 (diff)
Context becomes a Maybe in the GHC AST
This prevents noLoc's appearing in the ParsedSource. Match the change in GHC.
Diffstat (limited to 'haddock-api/src/Haddock/Interface/Specialize.hs')
-rw-r--r--haddock-api/src/Haddock/Interface/Specialize.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/haddock-api/src/Haddock/Interface/Specialize.hs b/haddock-api/src/Haddock/Interface/Specialize.hs
index f37e1da9..5ef5d92d 100644
--- a/haddock-api/src/Haddock/Interface/Specialize.hs
+++ b/haddock-api/src/Haddock/Interface/Specialize.hs
@@ -284,7 +284,7 @@ renameType (HsForAllTy x tele lt) =
<*> renameLType lt
renameType (HsQualTy x lctxt lt) =
HsQualTy x
- <$> located renameContext lctxt
+ <$> renameMContext lctxt
<*> renameLType lt
renameType (HsTyVar x ip name) = HsTyVar x ip <$> located renameName name
renameType t@(HsStarTy _ _) = pure t
@@ -325,6 +325,11 @@ renameLKind = renameLType
renameLTypes :: [LHsType GhcRn] -> Rename (IdP GhcRn) [LHsType GhcRn]
renameLTypes = mapM renameLType
+renameMContext :: Maybe (LHsContext GhcRn) -> Rename (IdP GhcRn) (Maybe (LHsContext GhcRn))
+renameMContext Nothing = return Nothing
+renameMContext (Just (L l ctxt)) = do
+ ctxt' <- renameContext ctxt
+ return (Just (L l ctxt'))
renameContext :: HsContext GhcRn -> Rename (IdP GhcRn) (HsContext GhcRn)
renameContext = renameLTypes