diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-02-21 21:16:24 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-01 17:32:12 -0500 |
commit | ce85cffc7c3afa55755ae8d1aa027761bf54bed4 (patch) | |
tree | 81986b7475f28a20bb80301107f9360a90b1e976 /compiler/GHC/Parser | |
parent | 6429943b0a377e076bcfd26c79ceb27cf2f4a9ab (diff) | |
download | haskell-ce85cffc7c3afa55755ae8d1aa027761bf54bed4.tar.gz |
Wrap LHsContext in Maybe in the GHC AST
If the context is missing it is captured as Nothing, rather than
putting a noLoc in the ParsedSource.
Updates haddock submodule
Diffstat (limited to 'compiler/GHC/Parser')
-rw-r--r-- | compiler/GHC/Parser/Errors/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess/Haddock.hs | 6 |
3 files changed, 6 insertions, 7 deletions
diff --git a/compiler/GHC/Parser/Errors/Ppr.hs b/compiler/GHC/Parser/Errors/Ppr.hs index 22103fa08b..8e083b0141 100644 --- a/compiler/GHC/Parser/Errors/Ppr.hs +++ b/compiler/GHC/Parser/Errors/Ppr.hs @@ -417,7 +417,7 @@ pp_err = \case PsErrIllegalDataTypeContext c -> text "Illegal datatype context (use DatatypeContexts):" - <+> pprLHsContext c + <+> pprLHsContext (Just c) PsErrMalformedDecl what for -> text "Malformed" <+> what diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 4b02077c9c..3159902647 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -180,7 +180,7 @@ mkClassDecl :: SrcSpan mkClassDecl loc (L _ (mcxt, tycl_hdr)) fds where_cls layoutInfo = do { (binds, sigs, ats, at_defs, _, docs) <- cvBindsAndSigs where_cls - ; let cxt = fromMaybe (noLoc []) mcxt + ; let cxt = mcxt ; (cls, tparams, fixity, ann) <- checkTyClHdr True tycl_hdr ; addAnnsAt loc ann -- Add any API Annotations to the top SrcSpan ; (tyvars,annst) <- checkTyVars (text "class") whereDots cls tparams @@ -224,10 +224,9 @@ mkDataDefn :: NewOrData -> P (HsDataDefn GhcPs) mkDataDefn new_or_data cType mcxt ksig data_cons maybe_deriv = do { checkDatatypeContext mcxt - ; let cxt = fromMaybe (noLoc []) mcxt ; return (HsDataDefn { dd_ext = noExtField , dd_ND = new_or_data, dd_cType = cType - , dd_ctxt = cxt + , dd_ctxt = mcxt , dd_cons = data_cons , dd_kindSig = ksig , dd_derivs = maybe_deriv }) } diff --git a/compiler/GHC/Parser/PostProcess/Haddock.hs b/compiler/GHC/Parser/PostProcess/Haddock.hs index 43ac07a482..c226b777ba 100644 --- a/compiler/GHC/Parser/PostProcess/Haddock.hs +++ b/compiler/GHC/Parser/PostProcess/Haddock.hs @@ -979,10 +979,10 @@ instance HasHaddock (Located (HsType GhcPs)) where pure $ L l (HsForAllTy noExtField tele body') -- (Eq a, Num a) => t - HsQualTy _ lhs rhs -> do - registerHdkA lhs + HsQualTy _ mlhs rhs -> do + traverse registerHdkA mlhs rhs' <- addHaddock rhs - pure $ L l (HsQualTy noExtField lhs rhs') + pure $ L l (HsQualTy noExtField mlhs rhs') -- arg -> res HsFunTy u mult lhs rhs -> do |