diff options
author | Richard Eisenberg <rae@richarde.dev> | 2019-11-05 13:11:19 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-02-08 10:16:33 -0500 |
commit | 7755ffc2920facb7ed74efe379ad825feeaf1024 (patch) | |
tree | c2bcece9de4776d99af32265084b78b7735d6654 /compiler/parser | |
parent | 309f8cfdad9cf81f5ee6003821810ea1205ae1d5 (diff) | |
download | haskell-7755ffc2920facb7ed74efe379ad825feeaf1024.tar.gz |
Introduce IsPass; refactor wrappers.
There are two main payloads of this patch:
1. This introduces IsPass, which allows e.g. printing
code to ask what pass it is running in (Renamed vs
Typechecked) and thus print extension fields. See
Note [IsPass] in Hs.Extension
2. This moves the HsWrap constructor into an extension
field, where it rightly belongs. This is done for
HsExpr and HsCmd, but not for HsPat, which is left
as an exercise for the reader.
There is also some refactoring around SyntaxExprs, but this
is really just incidental.
This patch subsumes !1721 (sorry @chreekat).
Along the way, there is a bit of refactoring in GHC.Hs.Extension,
including the removal of NameOrRdrName in favor of NoGhcTc.
This meant that we had no real need for GHC.Hs.PlaceHolder, so
I got rid of it.
Updates haddock submodule.
-------------------------
Metric Decrease:
haddock.compiler
-------------------------
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Parser.y | 2 | ||||
-rw-r--r-- | compiler/parser/RdrHsSyn.hs | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 8f9be68f5a..8d3757f563 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -2439,7 +2439,7 @@ decl_no_th :: { LHsDecl GhcPs } -- a FunBind or PatBind back from checkValDef. See Note -- [FunBind vs PatBind] case r of { - (FunBind _ n _ _ _) -> + (FunBind _ n _ _) -> amsL l (mj AnnFunId n:(fst $2)) >> return () ; (PatBind _ (L lh _lhs) _rhs _) -> amsL lh (fst $2) >> return () } ; diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index b2e8806caa..a4ca9aaf76 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -56,7 +56,7 @@ module RdrHsSyn ( checkContext, -- HsType -> P HsContext checkPattern, -- HsExp -> P HsPat checkPattern_msg, - checkMonadComp, -- P (HsStmtContext RdrName) + checkMonadComp, -- P (HsStmtContext GhcPs) checkValDef, -- (SrcLoc, HsExp, HsRhs, [HsDecl]) -> P HsDecl checkValSigLhs, LRuleTyTmVar, RuleTyTmVar(..), @@ -111,7 +111,6 @@ import CoAxiom ( Role, fsFromRole ) import RdrName import Name import BasicTypes -import TcEvidence ( idHsWrapper ) import Lexer import Lexeme ( isLexCon ) import Type ( TyThing(..), funTyCon ) @@ -1194,7 +1193,6 @@ makeFunBind fn ms = FunBind { fun_ext = noExtField, fun_id = fn, fun_matches = mkMatchGroup FromSource ms, - fun_co_fn = idHsWrapper, fun_tick = [] } -- See Note [FunBind vs PatBind] @@ -1675,7 +1673,7 @@ mergeDataCon all_xs = -- If the flag MonadComprehensions is set, return a 'MonadComp' context, -- otherwise use the usual 'ListComp' context -checkMonadComp :: PV (HsStmtContext Name) +checkMonadComp :: PV (HsStmtContext GhcRn) checkMonadComp = do monadComprehensions <- getBit MonadComprehensionsBit return $ if monadComprehensions @@ -2275,7 +2273,7 @@ data Frame -- ^ If-expression: if p then x else y | FrameCase LFrame [LFrameMatch] -- ^ Case-expression: case x of { p1 -> e1; p2 -> e2 } - | FrameDo (HsStmtContext Name) [LFrameStmt] + | FrameDo (HsStmtContext GhcRn) [LFrameStmt] -- ^ Do-expression: do { s1; a <- s2; s3 } ... | FrameExpr (HsExpr GhcPs) -- unambiguously an expression |