diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2019-10-06 12:52:27 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-01-08 06:16:31 -0500 |
commit | d491a6795d507eabe35d8aec63c534d29f2d305b (patch) | |
tree | 25d60450944f4c1ce6bea35b65f58dc7d761ad67 | |
parent | b69a3460d11cba49e861f708100801c8e25efa3e (diff) | |
download | haskell-d491a6795d507eabe35d8aec63c534d29f2d305b.tar.gz |
Module hierarchy: Renamer (cf #13009)
47 files changed, 230 insertions, 239 deletions
diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs index 2146cc0c07..69cfd0a111 100644 --- a/compiler/GHC/Hs/Decls.hs +++ b/compiler/GHC/Hs/Decls.hs @@ -383,7 +383,7 @@ Plan of attack: (See RnHiFiles.getSysBinders) - When typechecking the decl, we build the implicit TyCons and Ids. - When doing so we look them up in the name cache (RnEnv.lookupSysName), + When doing so we look them up in the name cache (GHC.Rename.Env.lookupSysName), to ensure correct module and provenance is set These are the two places that we have to conjure up the magic derived @@ -908,7 +908,7 @@ Invariants ones. See Note [Dependency analsis of type, class, and instance decls] -in RnSource for more info. +in GHC.Rename.Source for more info. -} -- | Type or Class Group @@ -1412,7 +1412,7 @@ There's a wrinkle in ConDeclGADT con_args = PrefixCon [] con_res_ty = a :*: (b -> (a :*: (b -> (a :+: b)))) - - In the renamer (RnSource.rnConDecl), we unravel it afer + - In the renamer (GHC.Rename.Source.rnConDecl), we unravel it afer operator fixities are sorted. So we generate. So we end up with con_args = PrefixCon [ a :*: b, a :*: b ] diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs index 13ca6b0eff..12daa75187 100644 --- a/compiler/GHC/Hs/Expr.hs +++ b/compiler/GHC/Hs/Expr.hs @@ -179,7 +179,7 @@ This is Less Cool than what we normally do for rebindable syntax, which is to make fully-instantiated piece of evidence at every use site. The Cmd way is Less Cool because * The renamer has to predict which methods are needed. - See the tedious RnExpr.methodNamesCmd. + See the tedious GHC.Rename.Expr.methodNamesCmd. * The desugarer has to know the polymorphic type of the instantiated method. This is checked by Inst.tcSyntaxName, but is less flexible @@ -1748,7 +1748,7 @@ type GhciStmt id = Stmt id (LHsExpr id) -- For details on above see note [Api annotations] in ApiAnnotation data StmtLR idL idR body -- body should always be (LHs**** idR) = LastStmt -- Always the last Stmt in ListComp, MonadComp, - -- and (after the renamer, see RnExpr.checkLastStmt) DoExpr, MDoExpr + -- and (after the renamer, see GHC.Rename.Expr.checkLastStmt) DoExpr, MDoExpr -- Not used for GhciStmtCtxt, PatGuard, which scope over other stuff (XLastStmt idL idR body) body @@ -1776,7 +1776,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR) -- appropriate applicative expression by the desugarer, but it is intended -- to be invisible in error messages. -- - -- For full details, see Note [ApplicativeDo] in RnExpr + -- For full details, see Note [ApplicativeDo] in GHC.Rename.Expr -- | ApplicativeStmt (XApplicativeStmt idL idR body) -- Post typecheck, Type of the body @@ -2297,7 +2297,7 @@ data HsSplice id -- AZ:TODO: use XSplice instead of HsSpliced | HsSpliced -- See Note [Delaying modFinalizers in untyped splices] in - -- RnSplice. + -- GHC.Rename.Splice. -- This is the result of splicing a splice. It is produced by -- the renamer and consumed by the typechecker. It lives only -- between the two. @@ -2333,7 +2333,7 @@ isTypedSplice _ = False -- Quasi-quotes are untyped splices -- | Finalizers produced by a splice with -- 'Language.Haskell.TH.Syntax.addModFinalizer' -- --- See Note [Delaying modFinalizers in untyped splices] in RnSplice. For how +-- See Note [Delaying modFinalizers in untyped splices] in GHC.Rename.Splice. For how -- this is used. -- newtype ThModFinalizers = ThModFinalizers [ForeignRef (TH.Q ())] @@ -2421,11 +2421,11 @@ distinguished by their UntypedSpliceFlavour UntypedExpSplice is also used for * quasi-quotes, where the pending expression expands to $(quoter "...blah...") - (see RnSplice.makePending, HsQuasiQuote case) + (see GHC.Rename.Splice.makePending, HsQuasiQuote case) * cross-stage lifting, where the pending expression expands to $(lift x) - (see RnSplice.checkCrossStageLifting) + (see GHC.Rename.Splice.checkCrossStageLifting) * Pending pattern splices (UntypedPatSplice), e.g., [| \$(f x) -> x |] diff --git a/compiler/GHC/Hs/Pat.hs b/compiler/GHC/Hs/Pat.hs index bb319181d3..945c2c195f 100644 --- a/compiler/GHC/Hs/Pat.hs +++ b/compiler/GHC/Hs/Pat.hs @@ -245,7 +245,7 @@ data Pat p -- a new hs-boot file. Not worth it. (SyntaxExpr p) -- (>=) function, of type t1->t2->Bool - (SyntaxExpr p) -- Name of '-' (see RnEnv.lookupSyntaxName) + (SyntaxExpr p) -- Name of '-' (see GHC.Rename.Env.lookupSyntaxName) -- ^ n+k pattern ------------ Pattern type signatures --------------- diff --git a/compiler/GHC/Hs/Types.hs b/compiler/GHC/Hs/Types.hs index 46cc1ecb24..92f064144a 100644 --- a/compiler/GHC/Hs/Types.hs +++ b/compiler/GHC/Hs/Types.hs @@ -144,7 +144,7 @@ Then we use a LHsBndrSig on the binder, so that the renamer can decorate it with the variables bound by the pattern ('a' in the first example, 'k' in the second), assuming that neither of them is in scope already -See also Note [Kind and type-variable binders] in RnTypes +See also Note [Kind and type-variable binders] in GHC.Rename.Types Note [HsType binders] ~~~~~~~~~~~~~~~~~~~~~ @@ -265,7 +265,7 @@ By "stable", we mean that any two variables who do not depend on each other preserve their existing left-to-right ordering. Implicitly bound variables are collected by the extract- family of functions -(extractHsTysRdrTyVars, extractHsTyVarBndrsKVs, etc.) in RnTypes. +(extractHsTysRdrTyVars, extractHsTyVarBndrsKVs, etc.) in GHC.Rename.Types. These functions thus promise to keep left-to-right ordering. Look for pointers to this note to see the places where the action happens. @@ -368,7 +368,7 @@ data HsImplicitBndrs pass thing -- See Note [HsType binders] -- Implicitly-bound kind & type vars -- Order is important; see -- Note [Ordering of implicit variables] - -- in RnTypes + -- in GHC.Rename.Types , hsib_body :: thing -- Main payload (type or list of types) } @@ -602,7 +602,8 @@ data HsType pass | HsParTy (XParTy pass) (LHsType pass) -- See Note [Parens in HsSyn] in GHC.Hs.Expr - -- Parenthesis preserved for the precedence re-arrangement in RnTypes + -- Parenthesis preserved for the precedence re-arrangement in + -- GHC.Rename.Types -- It's important that a * (b + c) doesn't get rearranged to (a*b) + c! -- ^ - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnOpen' @'('@, -- 'ApiAnnotation.AnnClose' @')'@ @@ -774,7 +775,7 @@ After renaming Qualified currently behaves exactly as Implicit, but it is deprecated to use it for implicit quantification. In this case, GHC 7.10 gives a warning; see -Note [Context quantification] in RnTypes, and #4426. +Note [Context quantification] in GHC.Rename.Types, and #4426. In GHC 8.0, Qualified will no longer bind variables and this will become an error. diff --git a/compiler/GHC/Hs/Utils.hs b/compiler/GHC/Hs/Utils.hs index 1b386fd703..f9133eba87 100644 --- a/compiler/GHC/Hs/Utils.hs +++ b/compiler/GHC/Hs/Utils.hs @@ -239,7 +239,7 @@ nlParPat p = noLoc (ParPat noExtField p) ------------------------------- -- These are the bits of syntax that contain rebindable names --- See RnEnv.lookupSyntaxName +-- See GHC.Rename.Env.lookupSyntaxName mkHsIntegral :: IntegralLit -> HsOverLit GhcPs mkHsFractional :: FractionalLit -> HsOverLit GhcPs diff --git a/compiler/rename/RnBinds.hs b/compiler/GHC/Rename/Binds.hs index 9b93af907b..f4c8e0effd 100644 --- a/compiler/rename/RnBinds.hs +++ b/compiler/GHC/Rename/Binds.hs @@ -4,7 +4,7 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[RnBinds]{Renaming and dependency analysis of bindings} +Renaming and dependency analysis of bindings This module does renaming and dependency analysis on value bindings in the abstract syntax. It does {\em not} do cycle-checks on class or @@ -12,7 +12,7 @@ type-synonym declarations; those cannot be done at this stage because they may be affected by renaming (which isn't fully worked out yet). -} -module RnBinds ( +module GHC.Rename.Binds ( -- Renaming top-level bindings rnTopBindsLHS, rnTopBindsBoot, rnValBindsRHS, @@ -28,18 +28,18 @@ module RnBinds ( import GhcPrelude -import {-# SOURCE #-} RnExpr( rnLExpr, rnStmts ) +import {-# SOURCE #-} GHC.Rename.Expr( rnLExpr, rnStmts ) import GHC.Hs import TcRnMonad -import RnTypes -import RnPat -import RnNames -import RnEnv -import RnFixity -import RnUtils ( HsDocContext(..), mapFvRn, extendTyVarEnvFVRn - , checkDupRdrNames, warnUnusedLocalBinds, - checkUnusedRecordWildcard +import GHC.Rename.Types +import GHC.Rename.Pat +import GHC.Rename.Names +import GHC.Rename.Env +import GHC.Rename.Fixity +import GHC.Rename.Utils ( HsDocContext(..), mapFvRn, extendTyVarEnvFVRn + , checkDupRdrNames, warnUnusedLocalBinds + , checkUnusedRecordWildcard , checkDupAndShadowedNames, bindLocalNamesFV ) import DynFlags import Module diff --git a/compiler/rename/RnHsDoc.hs b/compiler/GHC/Rename/Doc.hs index 6af59a0210..2f6a796196 100644 --- a/compiler/rename/RnHsDoc.hs +++ b/compiler/GHC/Rename/Doc.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ViewPatterns #-} -module RnHsDoc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where +module GHC.Rename.Doc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where import GhcPrelude diff --git a/compiler/rename/RnEnv.hs b/compiler/GHC/Rename/Env.hs index 4ce5805785..3b0f766a37 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/GHC/Rename/Env.hs @@ -1,13 +1,13 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-2006 -RnEnv contains functions which convert RdrNames into Names. +GHC.Rename.Env contains functions which convert RdrNames into Names. -} {-# LANGUAGE CPP, MultiWayIf, NamedFieldPuns #-} -module RnEnv ( +module GHC.Rename.Env ( newTopSrcBinder, lookupLocatedTopBndrRn, lookupTopBndrRn, lookupLocatedOccRn, lookupOccRn, lookupOccRn_maybe, @@ -76,8 +76,8 @@ import FastString import Control.Monad import ListSetOps ( minusList ) import qualified GHC.LanguageExtensions as LangExt -import RnUnbound -import RnUtils +import GHC.Rename.Unbound +import GHC.Rename.Utils import qualified Data.Semigroup as Semi import Data.Either ( partitionEithers ) import Data.List (find) @@ -201,7 +201,7 @@ newTopSrcBinder (L loc rdr_name) ; stage <- getStage ; if isBrackStage stage then -- We are inside a TH bracket, so make an *Internal* name - -- See Note [Top-level Names in Template Haskell decl quotes] in RnNames + -- See Note [Top-level Names in Template Haskell decl quotes] in GHC.Rename.Names do { uniq <- newUnique ; return (mkInternalName uniq (rdrNameOcc rdr_name) loc) } else @@ -217,7 +217,7 @@ newTopSrcBinder (L loc rdr_name) * * ********************************************************* -Looking up a name in the RnEnv. +Looking up a name in the GHC.Rename.Env. Note [Type and class operator definitions] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -393,7 +393,7 @@ lookupFamInstName :: Maybe Name -> Located RdrName -> RnM (Located Name) -- Used for TyData and TySynonym family instances only, -- See Note [Family instance binders] -lookupFamInstName (Just cls) tc_rdr -- Associated type; c.f RnBinds.rnMethodBind +lookupFamInstName (Just cls) tc_rdr -- Associated type; c.f GHC.Rename.Binds.rnMethodBind = wrapLocM (lookupInstDeclBndr cls (text "associated type")) tc_rdr lookupFamInstName Nothing tc_rdr -- Family instance; tc_rdr is an *occurrence* = lookupLocatedOccRn tc_rdr @@ -795,19 +795,19 @@ These System names are generated by Convert.thRdrName But, constructors and the like need External Names, not System Names! So we do the following - * In RnEnv.newTopSrcBinder we spot Exact RdrNames that wrap a + * In GHC.Rename.Env.newTopSrcBinder we spot Exact RdrNames that wrap a non-External Name, and make an External name for it. This is the name that goes in the GlobalRdrEnv * When looking up an occurrence of an Exact name, done in - RnEnv.lookupExactOcc, we find the Name with the right unique in the + GHC.Rename.Env.lookupExactOcc, we find the Name with the right unique in the GlobalRdrEnv, and use the one from the envt -- it will be an External Name in the case of the data type/constructor above. * Exact names are also use for purely local binders generated by TH, such as \x_33. x_33 Both binder and occurrence are Exact RdrNames. The occurrence - gets looked up in the LocalRdrEnv by RnEnv.lookupOccRn, and + gets looked up in the LocalRdrEnv by GHC.Rename.Env.lookupOccRn, and misses, because lookupLocalRdrEnv always returns Nothing for an Exact Name. Now we fall through to lookupExactOcc, which will find the Name is not in the GlobalRdrEnv, so we just use @@ -905,7 +905,7 @@ lookupOccRn rdr_name Nothing -> reportUnboundName rdr_name } -- Only used in one place, to rename pattern synonym binders. --- See Note [Renaming pattern synonym variables] in RnBinds +-- See Note [Renaming pattern synonym variables] in GHC.Rename.Binds lookupLocalOccRn :: RdrName -> RnM Name lookupLocalOccRn rdr_name = do { mb_name <- lookupLocalOccRn_maybe rdr_name diff --git a/compiler/rename/RnExpr.hs b/compiler/GHC/Rename/Expr.hs index 693d818f67..0cae30b1f7 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/GHC/Rename/Expr.hs @@ -1,7 +1,7 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[RnExpr]{Renaming of expressions} +Renaming of expressions Basically dependency analysis. @@ -16,7 +16,7 @@ free variables. {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-} -module RnExpr ( +module GHC.Rename.Expr ( rnLExpr, rnExpr, rnStmts ) where @@ -24,23 +24,23 @@ module RnExpr ( import GhcPrelude -import RnBinds ( rnLocalBindsAndThen, rnLocalValBindsLHS, rnLocalValBindsRHS, - rnMatchGroup, rnGRHS, makeMiniFixityEnv) +import GHC.Rename.Binds ( rnLocalBindsAndThen, rnLocalValBindsLHS, rnLocalValBindsRHS + , rnMatchGroup, rnGRHS, makeMiniFixityEnv) import GHC.Hs import TcEnv ( isBrackStage ) import TcRnMonad import Module ( getModule ) -import RnEnv -import RnFixity -import RnUtils ( HsDocContext(..), bindLocalNamesFV, checkDupNames +import GHC.Rename.Env +import GHC.Rename.Fixity +import GHC.Rename.Utils ( HsDocContext(..), bindLocalNamesFV, checkDupNames , bindLocalNames , mapMaybeFvRn, mapFvRn , warnUnusedLocalBinds, typeAppErr , checkUnusedRecordWildcard ) -import RnUnbound ( reportUnboundName ) -import RnSplice ( rnBracket, rnSpliceExpr, checkThLocalName ) -import RnTypes -import RnPat +import GHC.Rename.Unbound ( reportUnboundName ) +import GHC.Rename.Splice ( rnBracket, rnSpliceExpr, checkThLocalName ) +import GHC.Rename.Types +import GHC.Rename.Pat import DynFlags import PrelNames diff --git a/compiler/rename/RnExpr.hs-boot b/compiler/GHC/Rename/Expr.hs-boot index 8a9c7818a1..9667b5b26c 100644 --- a/compiler/rename/RnExpr.hs-boot +++ b/compiler/GHC/Rename/Expr.hs-boot @@ -1,4 +1,4 @@ -module RnExpr where +module GHC.Rename.Expr where import Name import GHC.Hs import NameSet ( FreeVars ) diff --git a/compiler/rename/RnFixity.hs b/compiler/GHC/Rename/Fixity.hs index aeff25094f..884e2593d0 100644 --- a/compiler/rename/RnFixity.hs +++ b/compiler/GHC/Rename/Fixity.hs @@ -6,10 +6,15 @@ This module contains code which maintains and manipulates the fixity environment during renaming. -} -module RnFixity ( MiniFixityEnv, - addLocalFixities, - lookupFixityRn, lookupFixityRn_help, - lookupFieldFixityRn, lookupTyFixityRn ) where +module GHC.Rename.Fixity + ( MiniFixityEnv + , addLocalFixities + , lookupFixityRn + , lookupFixityRn_help + , lookupFieldFixityRn + , lookupTyFixityRn + ) +where import GhcPrelude @@ -28,7 +33,7 @@ import Outputable import Maybes import Data.List import Data.Function ( on ) -import RnUnbound +import GHC.Rename.Unbound {- ********************************************************* @@ -97,7 +102,7 @@ lookupFixity is a bit strange. * Top-level fixity decls in this module may be for Names that are either Global (constructors, class operations) or Local/Exported (everything else) - (See notes with RnNames.getLocalDeclBinders for why we have this split.) + (See notes with GHC.Rename.Names.getLocalDeclBinders for why we have this split.) We put them all in the local fixity environment -} diff --git a/compiler/rename/RnNames.hs b/compiler/GHC/Rename/Names.hs index 7cb2aeafbb..9ead354935 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/GHC/Rename/Names.hs @@ -1,7 +1,7 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[RnNames]{Extracting imported and top-level names in scope} +Extracting imported and top-level names in scope -} {-# LANGUAGE CPP, NondecreasingIndentation, MultiWayIf, NamedFieldPuns #-} @@ -10,7 +10,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} -module RnNames ( +module GHC.Rename.Names ( rnImports, getLocalNonValBinders, newRecordSelector, extendGlobalRdrEnvRn, gresFromAvails, @@ -35,9 +35,9 @@ import DynFlags import TyCoPpr import GHC.Hs import TcEnv -import RnEnv -import RnFixity -import RnUtils ( warnUnusedTopBinds, mkFieldEnv ) +import GHC.Rename.Env +import GHC.Rename.Fixity +import GHC.Rename.Utils ( warnUnusedTopBinds, mkFieldEnv ) import GHC.Iface.Load ( loadSrcInterface ) import TcRnMonad import PrelNames @@ -504,7 +504,7 @@ created by its bindings. Note [Top-level Names in Template Haskell decl quotes] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ See also: Note [Interactively-bound Ids in GHCi] in HscTypes - Note [Looking up Exact RdrNames] in RnEnv + Note [Looking up Exact RdrNames] in GHC.Rename.Env Consider a Template Haskell declaration quotation like this: module M where @@ -513,7 +513,7 @@ When renaming the declarations inside [d| ...|], we treat the top level binders specially in two ways 1. We give them an Internal Name, not (as usual) an External one. - This is done by RnEnv.newTopSrcBinder. + This is done by GHC.Rename.Env.newTopSrcBinder. 2. We make them *shadow* the outer bindings. See Note [GlobalRdrEnv shadowing] @@ -797,7 +797,7 @@ newRecordSelector overload_ok (dc:_) (L loc (FieldOcc _ (L _ fld))) -- sites. This is needed to correctly support record -- selectors in Template Haskell. See Note [Binders in -- Template Haskell] in Convert.hs and Note [Looking up - -- Exact RdrNames] in RnEnv.hs. + -- Exact RdrNames] in GHC.Rename.Env. | otherwise = mkRdrUnqual (flSelector qualFieldLbl) {- diff --git a/compiler/rename/RnPat.hs b/compiler/GHC/Rename/Pat.hs index 59ab5446cd..9b03c83681 100644 --- a/compiler/rename/RnPat.hs +++ b/compiler/GHC/Rename/Pat.hs @@ -1,7 +1,7 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[RnPat]{Renaming of patterns} +Renaming of patterns Basically dependency analysis. @@ -18,7 +18,7 @@ free variables. {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE DeriveFunctor #-} -module RnPat (-- main entry points +module GHC.Rename.Pat (-- main entry points rnPat, rnPats, rnBindPat, rnPatAndThen, NameMaker, applyNameMaker, -- a utility for making names: @@ -43,22 +43,22 @@ module RnPat (-- main entry points import GhcPrelude -import {-# SOURCE #-} RnExpr ( rnLExpr ) -import {-# SOURCE #-} RnSplice ( rnSplicePat ) +import {-# SOURCE #-} GHC.Rename.Expr ( rnLExpr ) +import {-# SOURCE #-} GHC.Rename.Splice ( rnSplicePat ) #include "HsVersions.h" import GHC.Hs import TcRnMonad import TcHsSyn ( hsOverLitName ) -import RnEnv -import RnFixity -import RnUtils ( HsDocContext(..), newLocalBndrRn, bindLocalNames +import GHC.Rename.Env +import GHC.Rename.Fixity +import GHC.Rename.Utils ( HsDocContext(..), newLocalBndrRn, bindLocalNames , warnUnusedMatches, newLocalBndrRn , checkUnusedRecordWildcard , checkDupNames, checkDupAndShadowedNames , checkTupSize , unknownSubordinateErr ) -import RnTypes +import GHC.Rename.Types import PrelNames import Name import NameSet @@ -246,7 +246,7 @@ newPatName (LetMk is_top fix_env) rdr_name -- however, this binding seems to work, and it only exists for -- the duration of the patterns and the continuation; -- then the top-level name is added to the global env - -- before going on to the RHSes (see RnSource.hs). + -- before going on to the RHSes (see GHC.Rename.Source). {- Note [View pattern usage] @@ -498,7 +498,7 @@ rnPatAndThen mk (SplicePat x (HsSpliced x2 mfs (HsSplicedPat pat))) rnPatAndThen mk (SplicePat _ splice) = do { eith <- liftCpsFV $ rnSplicePat splice - ; case eith of -- See Note [rnSplicePat] in RnSplice + ; case eith of -- See Note [rnSplicePat] in GHC.Rename.Splice Left not_yet_renamed -> rnPatAndThen mk not_yet_renamed Right already_renamed -> return already_renamed } diff --git a/compiler/rename/RnSource.hs b/compiler/GHC/Rename/Source.hs index a166a65bfb..648dc29456 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/GHC/Rename/Source.hs @@ -1,7 +1,7 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[RnSource]{Main pass of renamer} +Main pass of renamer -} {-# LANGUAGE CPP #-} @@ -10,7 +10,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-} -module RnSource ( +module GHC.Rename.Source ( rnSrcDecls, addTcgDUs, findSplice ) where @@ -18,23 +18,23 @@ module RnSource ( import GhcPrelude -import {-# SOURCE #-} RnExpr( rnLExpr ) -import {-# SOURCE #-} RnSplice ( rnSpliceDecl, rnTopSpliceDecls ) +import {-# SOURCE #-} GHC.Rename.Expr( rnLExpr ) +import {-# SOURCE #-} GHC.Rename.Splice ( rnSpliceDecl, rnTopSpliceDecls ) import GHC.Hs import FieldLabel import RdrName -import RnTypes -import RnBinds -import RnEnv -import RnUtils ( HsDocContext(..), mapFvRn, bindLocalNames +import GHC.Rename.Types +import GHC.Rename.Binds +import GHC.Rename.Env +import GHC.Rename.Utils ( HsDocContext(..), mapFvRn, bindLocalNames , checkDupRdrNames, inHsDocContext, bindLocalNamesFV , checkShadowedRdrNames, warnUnusedTypePatterns , extendTyVarEnvFVRn, newLocalBndrsRn , withHsDocContext ) -import RnUnbound ( mkUnboundName, notInScopeErr ) -import RnNames -import RnHsDoc ( rnHsDoc, rnMbLHsDoc ) +import GHC.Rename.Unbound ( mkUnboundName, notInScopeErr ) +import GHC.Rename.Names +import GHC.Rename.Doc ( rnHsDoc, rnMbLHsDoc ) import TcAnnotations ( annCtxt ) import TcRnMonad @@ -1634,7 +1634,7 @@ rnTyClDecl (ClassDecl { tcdCtxt = context, tcdLName = lcls, ; (at_defs', fv_at_defs) <- rnList (rnTyFamDefltDecl cls') at_defs -- No need to check for duplicate associated type decls - -- since that is done by RnNames.extendGlobalRdrEnvRn + -- since that is done by GHC.Rename.Names.extendGlobalRdrEnvRn -- Check the signatures -- First process the class op sigs (op_sigs), then the fixity sigs (non_op_sigs). @@ -1658,7 +1658,7 @@ rnTyClDecl (ClassDecl { tcdCtxt = context, tcdLName = lcls, ; (mbinds', sigs', meth_fvs) <- rnMethodBinds True cls' (hsAllLTyVarNames tyvars') mbinds sigs -- No need to check for duplicate method signatures - -- since that is done by RnNames.extendGlobalRdrEnvRn + -- since that is done by GHC.Rename.Names.extendGlobalRdrEnvRn -- and the methods are already in scope -- Haddock docs @@ -1736,7 +1736,7 @@ rnDataDefn doc (HsDataDefn { dd_ND = new_or_data, dd_cType = cType | otherwise = setLocalRdrEnv emptyLocalRdrEnv } ; (condecls', con_fvs) <- zap_lcl_env $ rnConDecls condecls -- No need to check for duplicate constructor decls - -- since that is done by RnNames.extendGlobalRdrEnvRn + -- since that is done by GHC.Rename.Names.extendGlobalRdrEnvRn ; let all_fvs = fvs1 `plusFV` fvs3 `plusFV` con_fvs `plusFV` sig_fvs @@ -2179,7 +2179,7 @@ rnConDeclDetails con doc (RecCon (L l fields)) = do { fls <- lookupConstructorFields con ; (new_fields, fvs) <- rnConDeclFields doc fls fields -- No need to check for duplicate fields - -- since that is done by RnNames.extendGlobalRdrEnvRn + -- since that is done by GHC.Rename.Names.extendGlobalRdrEnvRn ; return (RecCon (L l new_fields), fvs) } ------------------------------------------------- diff --git a/compiler/rename/RnSplice.hs b/compiler/GHC/Rename/Splice.hs index 4094402697..5211834c0e 100644 --- a/compiler/rename/RnSplice.hs +++ b/compiler/GHC/Rename/Splice.hs @@ -2,7 +2,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-} -module RnSplice ( +module GHC.Rename.Splice ( rnTopSpliceDecls, rnSpliceType, rnSpliceExpr, rnSplicePat, rnSpliceDecl, rnBracket, @@ -20,20 +20,20 @@ import GHC.Hs import RdrName import TcRnMonad -import RnEnv -import RnUtils ( HsDocContext(..), newLocalBndrRn ) -import RnUnbound ( isUnboundName ) -import RnSource ( rnSrcDecls, findSplice ) -import RnPat ( rnPat ) +import GHC.Rename.Env +import GHC.Rename.Utils ( HsDocContext(..), newLocalBndrRn ) +import GHC.Rename.Unbound ( isUnboundName ) +import GHC.Rename.Source ( rnSrcDecls, findSplice ) +import GHC.Rename.Pat ( rnPat ) import BasicTypes ( TopLevelFlag, isTopLevel, SourceText(..) ) import Outputable import Module import SrcLoc -import RnTypes ( rnLHsType ) +import GHC.Rename.Types ( rnLHsType ) import Control.Monad ( unless, when ) -import {-# SOURCE #-} RnExpr ( rnLExpr ) +import {-# SOURCE #-} GHC.Rename.Expr ( rnLExpr ) import TcEnv ( checkWellStaged ) import THNames ( liftName ) @@ -584,7 +584,7 @@ are given names during renaming. These names are collected right after renaming. The names generated for anonymous wild cards in TH type splices will thus be collected as well. -For more details about renaming wild cards, see RnTypes.rnHsSigWcType +For more details about renaming wild cards, see GHC.Rename.Types.rnHsSigWcType Note that partial type signatures are fully supported in TH declaration splices, e.g.: @@ -685,10 +685,10 @@ Note [rnSplicePat] Renaming a pattern splice is a bit tricky, because we need the variables bound in the pattern to be in scope in the RHS of the pattern. This scope management is effectively done by using continuation-passing style in -RnPat, through the CpsRn monad. We don't wish to be in that monad here +GHC.Rename.Pat, through the CpsRn monad. We don't wish to be in that monad here (it would create import cycles and generally conflict with renaming other splices), so we really want to return a (Pat RdrName) -- the result of -running the splice -- which can then be further renamed in RnPat, in +running the splice -- which can then be further renamed in GHC.Rename.Pat, in the CpsRn monad. The problem is that if we're renaming a splice within a bracket, we diff --git a/compiler/rename/RnSplice.hs-boot b/compiler/GHC/Rename/Splice.hs-boot index cd6021027e..b61a866331 100644 --- a/compiler/rename/RnSplice.hs-boot +++ b/compiler/GHC/Rename/Splice.hs-boot @@ -1,4 +1,4 @@ -module RnSplice where +module GHC.Rename.Splice where import GhcPrelude import GHC.Hs diff --git a/compiler/rename/RnTypes.hs b/compiler/GHC/Rename/Types.hs index 724dea866d..b5c950618c 100644 --- a/compiler/rename/RnTypes.hs +++ b/compiler/GHC/Rename/Types.hs @@ -1,7 +1,6 @@ {- (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 -\section[RnSource]{Main pass of renamer} -} {-# LANGUAGE ScopedTypeVariables #-} @@ -9,7 +8,7 @@ {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TypeFamilies #-} -module RnTypes ( +module GHC.Rename.Types ( -- Type related stuff rnHsType, rnLHsType, rnLHsTypes, rnContext, rnHsKind, rnLHsKind, rnLHsTypeArgs, @@ -35,17 +34,17 @@ module RnTypes ( import GhcPrelude -import {-# SOURCE #-} RnSplice( rnSpliceType ) +import {-# SOURCE #-} GHC.Rename.Splice( rnSpliceType ) import DynFlags import GHC.Hs -import RnHsDoc ( rnLHsDoc, rnMbLHsDoc ) -import RnEnv -import RnUtils ( HsDocContext(..), withHsDocContext, mapFvRn - , pprHsDocContext, bindLocalNamesFV, typeAppErr - , newLocalBndrRn, checkDupRdrNames, checkShadowedRdrNames ) -import RnFixity ( lookupFieldFixityRn, lookupFixityRn - , lookupTyFixityRn ) +import GHC.Rename.Doc ( rnLHsDoc, rnMbLHsDoc ) +import GHC.Rename.Env +import GHC.Rename.Utils ( HsDocContext(..), withHsDocContext, mapFvRn + , pprHsDocContext, bindLocalNamesFV, typeAppErr + , newLocalBndrRn, checkDupRdrNames, checkShadowedRdrNames ) +import GHC.Rename.Fixity ( lookupFieldFixityRn, lookupFixityRn + , lookupTyFixityRn ) import TcRnMonad import RdrName import PrelNames @@ -71,7 +70,7 @@ import Control.Monad ( unless, when ) #include "HsVersions.h" {- -These type renamers are in a separate module, rather than in (say) RnSource, +These type renamers are in a separate module, rather than in (say) GHC.Rename.Source, to break several loop. ********************************************************* @@ -1026,13 +1025,13 @@ newTyVarNameRn mb_assoc (L loc rdr) When renaming a ConDeclField, we have to find the FieldLabel associated with each field. But we already have all the FieldLabels available (since they were brought into scope by -RnNames.getLocalNonValBinders), so we just take the list as an +GHC.Rename.Names.getLocalNonValBinders), so we just take the list as an argument, build a map and look them up. -} rnConDeclFields :: HsDocContext -> [FieldLabel] -> [LConDeclField GhcPs] -> RnM ([LConDeclField GhcRn], FreeVars) --- Also called from RnSource +-- Also called from GHC.Rename.Source -- No wildcards can appear in record fields rnConDeclFields ctxt fls fields = mapFvRn (rnField fl_env env) fields @@ -1189,7 +1188,7 @@ instance Outputable OpName where get_op :: LHsExpr GhcRn -> OpName -- An unbound name could be either HsVar or HsUnboundVar --- See RnExpr.rnUnboundVar +-- See GHC.Rename.Expr.rnUnboundVar get_op (L _ (HsVar _ n)) = NormalOp (unLoc n) get_op (L _ (HsUnboundVar _ uv)) = UnboundOp uv get_op (L _ (HsRecFld _ fld)) = RecFldOp fld diff --git a/compiler/rename/RnUnbound.hs b/compiler/GHC/Rename/Unbound.hs index 2de2fc1f0c..f8b33aa748 100644 --- a/compiler/rename/RnUnbound.hs +++ b/compiler/GHC/Rename/Unbound.hs @@ -4,15 +4,18 @@ This module contains helper functions for reporting and creating unbound variables. -} -module RnUnbound ( mkUnboundName - , mkUnboundNameRdr - , isUnboundName - , reportUnboundName - , unknownNameSuggestions - , WhereLooking(..) - , unboundName - , unboundNameX - , notInScopeErr ) where +module GHC.Rename.Unbound + ( mkUnboundName + , mkUnboundNameRdr + , isUnboundName + , reportUnboundName + , unknownNameSuggestions + , WhereLooking(..) + , unboundName + , unboundNameX + , notInScopeErr + ) +where import GhcPrelude diff --git a/compiler/rename/RnUtils.hs b/compiler/GHC/Rename/Utils.hs index 88996e31b1..b2d8fad31c 100644 --- a/compiler/rename/RnUtils.hs +++ b/compiler/GHC/Rename/Utils.hs @@ -7,7 +7,7 @@ This module contains miscellaneous functions related to renaming. {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE TypeFamilies #-} -module RnUtils ( +module GHC.Rename.Utils ( checkDupRdrNames, checkShadowedRdrNames, checkDupNames, checkDupAndShadowedNames, dupNamesErr, checkTupSize, diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs index 2a813344df..298bc6660a 100644 --- a/compiler/GHC/ThToHs.hs +++ b/compiler/GHC/ThToHs.hs @@ -1074,7 +1074,7 @@ the trees to reflect the fixities of the underlying operators: UInfixE x * (UInfixE y + z) ---> (x * y) + z This is done by the renamer (see @mkOppAppRn@, @mkConOppPatRn@, and -@mkHsOpTyRn@ in RnTypes), which expects that the input will be completely +@mkHsOpTyRn@ in GHC.Rename.Types), which expects that the input will be completely right-biased for types and left-biased for everything else. So we left-bias the trees of @UInfixP@ and @UInfixE@ and right-bias the trees of @UInfixT@. @@ -1966,7 +1966,7 @@ usually want to print the name with the unique, and that is indeed the way System Names are printed. There's a small complication of course; see Note [Looking up Exact -RdrNames] in RnEnv. +RdrNames] in GHC.Rename.Env. -} {- diff --git a/compiler/basicTypes/Avail.hs b/compiler/basicTypes/Avail.hs index 291c95abe8..6c15828cde 100644 --- a/compiler/basicTypes/Avail.hs +++ b/compiler/basicTypes/Avail.hs @@ -200,7 +200,7 @@ availNamesWithOccs (AvailTC _ ns fs) plusAvail :: AvailInfo -> AvailInfo -> AvailInfo plusAvail a1 a2 | debugIsOn && availName a1 /= availName a2 - = pprPanic "RnEnv.plusAvail names differ" (hsep [ppr a1,ppr a2]) + = pprPanic "GHC.Rename.Env.plusAvail names differ" (hsep [ppr a1,ppr a2]) plusAvail a1@(Avail {}) (Avail {}) = a1 plusAvail (AvailTC _ [] []) a2@(AvailTC {}) = a2 plusAvail a1@(AvailTC {}) (AvailTC _ [] []) = a1 @@ -218,7 +218,7 @@ plusAvail (AvailTC n1 ss1 fs1) (AvailTC _ [] fs2) = AvailTC n1 ss1 (fs1 `unionLists` fs2) plusAvail (AvailTC n1 [] fs1) (AvailTC _ ss2 fs2) = AvailTC n1 ss2 (fs1 `unionLists` fs2) -plusAvail a1 a2 = pprPanic "RnEnv.plusAvail" (hsep [ppr a1,ppr a2]) +plusAvail a1 a2 = pprPanic "GHC.Rename.Env.plusAvail" (hsep [ppr a1,ppr a2]) -- | trims an 'AvailInfo' to keep only a single name trimAvail :: AvailInfo -> Name -> AvailInfo diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs index f0edc56778..7584fa4380 100644 --- a/compiler/basicTypes/OccName.hs +++ b/compiler/basicTypes/OccName.hs @@ -207,7 +207,7 @@ pprNameSpaceBrief TcClsName = text "tc" -- demoteNameSpace lowers the NameSpace if possible. We can not know -- in advance, since a TvName can appear in an HsTyVar. --- See Note [Demotion] in RnEnv +-- See Note [Demotion] in GHC.Rename.Env demoteNameSpace :: NameSpace -> Maybe NameSpace demoteNameSpace VarName = Nothing demoteNameSpace DataName = Nothing diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs index 89b70b1f7b..87e6fd41b6 100644 --- a/compiler/basicTypes/RdrName.hs +++ b/compiler/basicTypes/RdrName.hs @@ -344,7 +344,7 @@ instance Ord RdrName where -- (@let@, @where@, lambda, @case@). -- It is keyed by OccName, because we never use it for qualified names -- We keep the current mapping, *and* the set of all Names in scope --- Reason: see Note [Splicing Exact names] in RnEnv +-- Reason: see Note [Splicing Exact names] in GHC.Rename.Env data LocalRdrEnv = LRE { lre_env :: OccEnv Name , lre_in_scope :: NameSet } @@ -416,7 +416,7 @@ Note [Local bindings with Exact Names] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With Template Haskell we can make local bindings that have Exact Names. Computing shadowing etc may use elemLocalRdrEnv (at least it certainly -does so in RnTpes.bindHsQTyVars), so for an Exact Name we must consult +does so in GHC.Rename.Types.bindHsQTyVars), so for an Exact Name we must consult the in-scope-name-set. @@ -444,7 +444,7 @@ type GlobalRdrEnv = OccEnv [GlobalRdrElt] -- INVARIANT 2: Imported provenance => Name is an ExternalName -- However LocalDefs can have an InternalName. This -- happens only when type-checking a [d| ... |] Template --- Haskell quotation; see this note in RnNames +-- Haskell quotation; see this note in GHC.Rename.Names -- Note [Top-level Names in Template Haskell decl quotes] -- -- INVARIANT 3: If the GlobalRdrEnv maps [occ -> gre], then @@ -928,7 +928,7 @@ pickGREsModExp :: ModuleName -> [GlobalRdrElt] -> [(GlobalRdrElt,GlobalRdrElt)] -- it is in scope qualified an unqualified respectively -- -- Used only for the 'module M' item in export list; --- see RnNames.exports_from_avail +-- see GHC.Rename.Names.exports_from_avail pickGREsModExp mod gres = mapMaybe (pickBothGRE mod) gres pickBothGRE :: ModuleName -> GlobalRdrElt -> Maybe (GlobalRdrElt, GlobalRdrElt) @@ -1039,7 +1039,7 @@ There are two reasons for shadowing: 'T' to mean the newly-declared 'T', not an old one. * Nested Template Haskell declaration brackets - See Note [Top-level Names in Template Haskell decl quotes] in RnNames + See Note [Top-level Names in Template Haskell decl quotes] in GHC.Rename.Names Consider a TH decl quote: module M where @@ -1234,7 +1234,7 @@ and are warned about. More precisely: 3. After processing all the RdrNames, bleat about any import-items that are unused. - This is done in RnNames.warnUnusedImportDecls. + This is done in GHC.Rename.Names.warnUnusedImportDecls. The function 'bestImport' returns the dominant import among the ImportSpecs it is given, implementing Step 2. We say import-item A diff --git a/compiler/deSugar/DsUsage.hs b/compiler/deSugar/DsUsage.hs index 9db10806d5..811e5f9b07 100644 --- a/compiler/deSugar/DsUsage.hs +++ b/compiler/deSugar/DsUsage.hs @@ -38,7 +38,7 @@ import System.FilePath {- Note [Module self-dependency] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -RnNames.calculateAvails asserts the invariant that a module must not occur in +GHC.Rename.Names.calculateAvails asserts the invariant that a module must not occur in its own dep_orphs or dep_finsts. However, if we aren't careful this can occur in the presence of hs-boot files: Consider that we have two modules, A and B, both with hs-boot files, @@ -88,7 +88,7 @@ mkDependencies iuid pluginModules | otherwise = raw_pkgs -- Set the packages required to be Safe according to Safe Haskell. - -- See Note [RnNames . Tracking Trust Transitively] + -- See Note [Tracking Trust Transitively] in GHC.Rename.Names sorted_pkgs = sort (Set.toList pkgs) trust_pkgs = imp_trust_pkgs imports dep_pkgs' = map (\x -> (x, x `Set.member` trust_pkgs)) sorted_pkgs diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 1e966e01a5..640f325c03 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -173,7 +173,6 @@ Library parser prelude profiling - rename simplCore specialise stranal @@ -425,18 +424,18 @@ Library CostCentre CostCentreState ProfInit - RnBinds - RnEnv - RnExpr - RnHsDoc - RnNames - RnPat - RnSource - RnSplice - RnTypes - RnFixity - RnUtils - RnUnbound + GHC.Rename.Binds + GHC.Rename.Env + GHC.Rename.Expr + GHC.Rename.Doc + GHC.Rename.Names + GHC.Rename.Pat + GHC.Rename.Source + GHC.Rename.Splice + GHC.Rename.Types + GHC.Rename.Fixity + GHC.Rename.Utils + GHC.Rename.Unbound CoreMonad CSE FloatIn diff --git a/compiler/main/DynamicLoading.hs b/compiler/main/DynamicLoading.hs index 53ae31f8ef..a48f0238be 100644 --- a/compiler/main/DynamicLoading.hs +++ b/compiler/main/DynamicLoading.hs @@ -33,7 +33,7 @@ import RdrName ( RdrName, ImportSpec(..), ImpDeclSpec(..) , ImpItemSpec(..), mkGlobalRdrEnv, lookupGRE_RdrName , gre_name, mkRdrQual ) import OccName ( OccName, mkVarOcc ) -import RnNames ( gresFromAvails ) +import GHC.Rename.Names ( gresFromAvails ) import Plugins import PrelNames ( pluginTyConName, frontendPluginTyConName ) diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index 0e0b853c9a..ffb9b3ced9 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -1017,9 +1017,10 @@ hscCheckSafeImports tcg_env = do -- -- The code for this is quite tricky as the whole algorithm is done in a few -- distinct phases in different parts of the code base. See --- RnNames.rnImportDecl for where package trust dependencies for a module are --- collected and unioned. Specifically see the Note [RnNames . Tracking Trust --- Transitively] and the Note [RnNames . Trust Own Package]. +-- GHC.Rename.Names.rnImportDecl for where package trust dependencies for a +-- module are collected and unioned. Specifically see the Note [Tracking Trust +-- Transitively] in GHC.Rename.Names and the Note [Trust Own Package] in +-- GHC.Rename.Names. checkSafeImports :: TcGblEnv -> Hsc TcGblEnv checkSafeImports tcg_env = do diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index 85aac8c7c4..6355c5dc95 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -1059,7 +1059,7 @@ data ModIface_ (phase :: ModIfacePhase) -- module is Safe (so doesn't require the package be trusted -- itself) but imports some trustworthy modules from its own -- package (which does require its own package be trusted). - -- See Note [RnNames . Trust Own Package] + -- See Note [Trust Own Package] in GHC.Rename.Names mi_complete_sigs :: [IfaceCompleteMatch], mi_doc_hdr :: Maybe HsDocString, @@ -1433,7 +1433,8 @@ data ModGuts mg_safe_haskell :: SafeHaskellMode, -- ^ Safe Haskell mode mg_trust_pkg :: Bool, -- ^ Do we need to trust our -- own package for Safe Haskell? - -- See Note [RnNames . Trust Own Package] + -- See Note [Trust Own Package] + -- in GHC.Rename.Names mg_doc_hdr :: !(Maybe HsDocString), -- ^ Module header. mg_decl_docs :: !DeclDocMap, -- ^ Docs on declarations. @@ -2467,7 +2468,7 @@ data Dependencies -- or that are in the dep_pkgs of those modules -- The bool indicates if the package is required to be -- trusted when the module is imported as a safe import - -- (Safe Haskell). See Note [RnNames . Tracking Trust Transitively] + -- (Safe Haskell). See Note [Tracking Trust Transitively] in GHC.Rename.Names , dep_orphs :: [Module] -- ^ Transitive closure of orphan modules (whether diff --git a/compiler/rename/rename.tex b/compiler/rename/rename.tex deleted file mode 100644 index b3f8e1d770..0000000000 --- a/compiler/rename/rename.tex +++ /dev/null @@ -1,18 +0,0 @@ -\documentstyle{report} -\input{lit-style} - -\begin{document} -\centerline{{\Large{rename}}} -\tableofcontents - -\input{Rename} % {Renaming and dependency analysis passes} -\input{RnSource} % {Main pass of renamer} -\input{RnMonad} % {The monad used by the renamer} -\input{RnEnv} % {Environment manipulation for the renamer monad} -\input{RnHsSyn} % {Specialisations of the @HsSyn@ syntax for the renamer} -\input{RnNames} % {Extracting imported and top-level names in scope} -\input{RnExpr} % {Renaming of expressions} -\input{RnBinds} % {Renaming and dependency analysis of bindings} -\input{RnIfaces} % {Cacheing and Renaming of Interfaces} - -\end{document} diff --git a/compiler/typecheck/ClsInst.hs b/compiler/typecheck/ClsInst.hs index d367d1df63..d6cfb6eaf5 100644 --- a/compiler/typecheck/ClsInst.hs +++ b/compiler/typecheck/ClsInst.hs @@ -18,7 +18,7 @@ import TcTypeable import TcMType import TcEvidence import Predicate -import RnEnv( addUsedGRE ) +import GHC.Rename.Env( addUsedGRE ) import RdrName( lookupGRE_FieldLabel ) import InstEnv import Inst( instDFunType ) diff --git a/compiler/typecheck/TcBackpack.hs b/compiler/typecheck/TcBackpack.hs index 2df8478123..7373f4287f 100644 --- a/compiler/typecheck/TcBackpack.hs +++ b/compiler/typecheck/TcBackpack.hs @@ -37,7 +37,7 @@ import TcSimplify import Constraint import TcOrigin import GHC.Iface.Load -import RnNames +import GHC.Rename.Names import ErrUtils import Id import Module @@ -50,7 +50,7 @@ import HscTypes import Outputable import Type import FastString -import RnFixity ( lookupFixityRn ) +import GHC.Rename.Fixity ( lookupFixityRn ) import Maybes import TcEnv import Var diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index ce2ea4c75a..3bf4defe1c 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -399,7 +399,7 @@ tcValBinds top_lvl binds sigs thing_inside { (binds', (extra_binds', thing)) <- tcBindGroups top_lvl sig_fn prag_fn binds $ do { thing <- thing_inside -- See Note [Pattern synonym builders don't yield dependencies] - -- in RnBinds + -- in GHC.Rename.Binds ; patsyn_builders <- mapM tcPatSynBuilderBind patsyns ; let extra_binds = [ (NonRecursive, builder) | builder <- patsyn_builders ] ; return (extra_binds, thing) } diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 9761120016..dac2251c9a 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -37,11 +37,11 @@ import TcHsType import TyCoRep import TyCoPpr ( pprTyVars ) -import RnNames( extendGlobalRdrEnvRn ) -import RnBinds -import RnEnv -import RnUtils ( bindLocalNamesFV ) -import RnSource ( addTcgDUs ) +import GHC.Rename.Names ( extendGlobalRdrEnvRn ) +import GHC.Rename.Binds +import GHC.Rename.Env +import GHC.Rename.Utils ( bindLocalNamesFV ) +import GHC.Rename.Source ( addTcgDUs ) import Avail import Unify( tcUnifyTy ) diff --git a/compiler/typecheck/TcDerivUtils.hs b/compiler/typecheck/TcDerivUtils.hs index 092e97983b..6cf57b34f1 100644 --- a/compiler/typecheck/TcDerivUtils.hs +++ b/compiler/typecheck/TcDerivUtils.hs @@ -644,7 +644,7 @@ getDataConFixityFun :: TyCon -> TcM (Name -> Fixity) -- If the TyCon is locally defined, we want the local fixity env; -- but if it is imported (which happens for standalone deriving) -- we need to get the fixity env from the interface file --- c.f. RnEnv.lookupFixity, and #9830 +-- c.f. GHC.Rename.Env.lookupFixity, and #9830 getDataConFixityFun tc = do { this_mod <- getModule ; if nameIsLocalOrFrom this_mod name diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 00d95c405b..31b693b7e9 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -22,7 +22,7 @@ import TcUnify( occCheckForErrors, MetaTyVarUpdateResult(..) ) import TcEnv( tcInitTidyEnv ) import TcType import TcOrigin -import RnUnbound ( unknownNameSuggestions ) +import GHC.Rename.Unbound ( unknownNameSuggestions ) import Type import TyCoRep import TyCoPpr ( pprTyVars, pprWithExplicitKindsWhen, pprSourceTyCon, pprWithTYPE ) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index bfbb4d260c..8f4f7beb54 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -36,8 +36,8 @@ import TcSigs ( tcUserTypeSig, tcInstSig ) import TcSimplify ( simplifyInfer, InferMode(..) ) import FamInst ( tcGetFamInstEnvs, tcLookupDataFamInst ) import FamInstEnv ( FamInstEnvs ) -import RnEnv ( addUsedGRE ) -import RnUtils ( addNameClashErrRn, unknownSubordinateErr ) +import GHC.Rename.Env ( addUsedGRE ) +import GHC.Rename.Utils ( addNameClashErrRn, unknownSubordinateErr ) import TcEnv import TcArrows import TcMatches @@ -968,10 +968,10 @@ tcExpr (ArithSeq _ witness seq) res_ty ************************************************************************ -} --- HsSpliced is an annotation produced by 'RnSplice.rnSpliceExpr'. +-- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSpliceExpr'. -- Here we get rid of it and add the finalizers to the global environment. -- --- See Note [Delaying modFinalizers in untyped splices] in RnSplice. +-- See Note [Delaying modFinalizers in untyped splices] in GHC.Rename.Splice. tcExpr (HsSpliceE _ (HsSpliced _ mod_finalizers (HsSplicedExpr expr))) res_ty = do addModFinalizersWithLclEnv mod_finalizers @@ -1975,13 +1975,13 @@ checkCrossStageLifting :: TopLevelFlag -> Id -> ThStage -> TcM () -- [|| map ||] -- There is no error-checking to do, because the renamer did that -- --- This is similar to checkCrossStageLifting in RnSplice, but +-- This is similar to checkCrossStageLifting in GHC.Rename.Splice, but -- this code is applied to *typed* brackets. checkCrossStageLifting top_lvl id (Brack _ (TcPending ps_var lie_var)) | isTopLevel top_lvl = when (isExternalName id_name) (keepAlive id_name) - -- See Note [Keeping things alive for Template Haskell] in RnSplice + -- See Note [Keeping things alive for Template Haskell] in GHC.Rename.Splice | otherwise = -- Nested identifiers, such as 'x' in diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 950c8687ce..17c027318b 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -634,7 +634,7 @@ tc_infer_hs_type mode (HsKindSig _ ty sig) ; ty' <- tc_lhs_type mode ty sig' ; return (ty', sig') } --- HsSpliced is an annotation produced by 'RnSplice.rnSpliceType' to communicate +-- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSpliceType' to communicate -- the splice location to the typechecker. Here we skip over it in order to have -- the same kind inferred for a given expression whether it was produced from -- splices or not. @@ -686,7 +686,7 @@ tc_hs_type _ ty@(HsRecTy {}) _ -- signatures) should have been removed by now = failWithTc (text "Record syntax is illegal here:" <+> ppr ty) --- HsSpliced is an annotation produced by 'RnSplice.rnSpliceType'. +-- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSpliceType'. -- Here we get rid of it and add the finalizers to the global environment -- while capturing the local environment. -- @@ -2507,7 +2507,7 @@ What should be the kind of `T` in the following example? (#15591) class C (a :: Type) where type T (x :: f a) -As per Note [Ordering of implicit variables] in RnTypes, we want to quantify +As per Note [Ordering of implicit variables] in GHC.Rename.Types, we want to quantify the kind variables in left-to-right order of first occurrence in order to support visible kind application. But we cannot perform this analysis on just T alone, since its variable `a` actually occurs /before/ `f` if you consider @@ -2752,7 +2752,7 @@ zonkAndScopedSort spec_tkvs -- Use zonkAndSkolemise because a skol_tv might be a TyVarTv -- Do a stable topological sort, following - -- Note [Ordering of implicit variables] in RnTypes + -- Note [Ordering of implicit variables] in GHC.Rename.Types ; return (scopedSort spec_tkvs) } -- | Generalize some of the free variables in the given type. diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs index abd3f82f24..c9d9125774 100644 --- a/compiler/typecheck/TcPat.hs +++ b/compiler/typecheck/TcPat.hs @@ -608,10 +608,10 @@ tc_pat penv (NPlusKPat _ (L nm_loc name) ge' minus'' ; return (pat', res) } --- HsSpliced is an annotation produced by 'RnSplice.rnSplicePat'. +-- HsSpliced is an annotation produced by 'GHC.Rename.Splice.rnSplicePat'. -- Here we get rid of it and add the finalizers to the global environment. -- --- See Note [Delaying modFinalizers in untyped splices] in RnSplice. +-- See Note [Delaying modFinalizers in untyped splices] in GHC.Rename.Splice. tc_pat penv (SplicePat _ (HsSpliced _ mod_finalizers (HsSplicedPat pat))) pat_ty thing_inside = do addModFinalizersWithLclEnv mod_finalizers diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 8bec345b82..dabe3ff612 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -49,17 +49,17 @@ module TcRnDriver ( import GhcPrelude import {-# SOURCE #-} TcSplice ( finishTH, runRemoteModFinalizers ) -import RnSplice ( rnTopSpliceDecls, traceSplice, SpliceInfo(..) ) -import GHC.Iface.Env( externaliseName ) +import GHC.Rename.Splice ( rnTopSpliceDecls, traceSplice, SpliceInfo(..) ) +import GHC.Iface.Env ( externaliseName ) import TcHsType import TcValidity( checkValidType ) import TcMatches import Inst( deeplyInstantiate ) import TcUnify( checkConstraints ) -import RnTypes -import RnExpr -import RnUtils ( HsDocContext(..) ) -import RnFixity ( lookupFixityRn ) +import GHC.Rename.Types +import GHC.Rename.Expr +import GHC.Rename.Utils ( HsDocContext(..) ) +import GHC.Rename.Fixity ( lookupFixityRn ) import MkId import TysWiredIn ( unitTy, mkListTy ) import Plugins @@ -102,9 +102,9 @@ import TcTyClsDecls import TcTypeable ( mkTypeableBinds ) import TcBackpack import GHC.Iface.Load -import RnNames -import RnEnv -import RnSource +import GHC.Rename.Names +import GHC.Rename.Env +import GHC.Rename.Source import ErrUtils import Id import IdInfo( IdDetails(..) ) @@ -633,7 +633,7 @@ tcRnHsBootDecls hsc_src decls <- rnTopSrcDecls first_group -- The empty list is for extra dependencies coming from .hs-boot files - -- See Note [Extra dependencies from .hs-boot files] in RnSource + -- See Note [Extra dependencies from .hs-boot files] in GHC.Rename.Source ; (gbl_env, lie) <- setGblEnv tcg_env $ captureTopConstraints $ do { -- NB: setGblEnv **before** captureTopConstraints so that diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs index 0f0067ab5d..19d8551f33 100644 --- a/compiler/typecheck/TcRnExports.hs +++ b/compiler/typecheck/TcRnExports.hs @@ -15,9 +15,9 @@ import RdrName import TcRnMonad import TcEnv import TcType -import RnNames -import RnEnv -import RnUnbound ( reportUnboundName ) +import GHC.Rename.Names +import GHC.Rename.Env +import GHC.Rename.Unbound ( reportUnboundName ) import ErrUtils import Id import IdInfo @@ -40,8 +40,8 @@ import FastString (fsLit) import Control.Monad import DynFlags -import RnHsDoc ( rnHsDoc ) -import RdrHsSyn ( setRdrNameSpace ) +import GHC.Rename.Doc ( rnHsDoc ) +import RdrHsSyn ( setRdrNameSpace ) import Data.Either ( partitionEithers ) {- diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index b2248073d8..25b0ad5f36 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -393,7 +393,7 @@ data FrontendResult -- should never be loaded into the EPS). However, if a -- hole module <A> is requested, we look for A.hi -- in the home library we are compiling. (See GHC.Iface.Load.) --- Similarly, in RnNames we check for self-imports using +-- Similarly, in GHC.Rename.Names we check for self-imports using -- identity modules, to allow signatures to import their implementor. -- -- - For recompilation avoidance, you want the identity module, @@ -650,7 +650,7 @@ data SelfBootInfo { sb_mds :: ModDetails -- There was a hi-boot file, , sb_tcs :: NameSet } -- defining these TyCons, -- What is sb_tcs used for? See Note [Extra dependencies from .hs-boot files] --- in RnSource +-- in GHC.Rename.Source {- Note [Tracking unused binding and imports] @@ -664,7 +664,7 @@ We gather three sorts of usage information and *used* Names (local or imported) Used (a) to report "defined but not used" - (see RnNames.reportUnusedNames) + (see GHC.Rename.Names.reportUnusedNames) (b) to generate version-tracking usage info in interface files (see GHC.Iface.Utils.mkUsedNames) This usage info is mainly gathered by the renamer's @@ -697,7 +697,7 @@ We gather three sorts of usage information (c) Top-level variables appearing free in a TH bracket See Note [Keeping things alive for Template Haskell] - in RnSplice + in GHC.Rename.Splice (d) The data constructor of a newtype that is used to solve a Coercible instance (e.g. #10347). Example @@ -719,8 +719,8 @@ We gather three sorts of usage information simplifier does not discard them as dead code, and so that they are exposed in the interface file (but not to export to the user). - * RnNames.reportUnusedNames. Where newtype data constructors like (d) - are imported, we don't want to report them as unused. + * GHC.Rename.Names.reportUnusedNames. Where newtype data constructors + like (d) are imported, we don't want to report them as unused. ************************************************************************ @@ -925,7 +925,7 @@ data ThStage -- See Note [Template Haskell state diagram] in TcSplice -- -- 'addModFinalizer' inserts finalizers here, and from here they are taken -- to construct an @HsSpliced@ annotation for untyped splices. See Note - -- [Delaying modFinalizers in untyped splices] in "RnSplice". + -- [Delaying modFinalizers in untyped splices] in GHC.Rename.Splice. -- -- For typed splices, the typechecker takes finalizers from here and -- inserts them in the list of finalizers in the global environment. @@ -1349,13 +1349,13 @@ data ImportAvails -- where True for the bool indicates the package is required to be -- trusted is the more logical design, doing so complicates a lot -- of code not concerned with Safe Haskell. - -- See Note [RnNames . Tracking Trust Transitively] + -- See Note [Tracking Trust Transitively] in GHC.Rename.Names imp_trust_own_pkg :: Bool, -- ^ Do we require that our own package is trusted? -- This is to handle efficiently the case where a Safe module imports -- a Trustworthy module that resides in the same package as it. - -- See Note [RnNames . Trust Own Package] + -- See Note [Trust Own Package] in GHC.Rename.Names imp_orphs :: [Module], -- ^ Orphan modules below us in the import tree (and maybe including diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index eb4f5027fb..48de0f7549 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -155,7 +155,7 @@ import TcErrors ( solverDepthErrorTcS ) import Name import Module ( HasModule, getModule ) import RdrName ( GlobalRdrEnv, GlobalRdrElt ) -import qualified RnEnv as TcM +import qualified GHC.Rename.Env as TcM import Var import VarEnv import VarSet diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index b256edb911..0351864199 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -58,15 +58,15 @@ import GHCi import HscMain -- These imports are the reason that TcSplice -- is very high up the module hierarchy -import RnSplice( traceSplice, SpliceInfo(..)) +import GHC.Rename.Splice( traceSplice, SpliceInfo(..)) import RdrName import HscTypes import GHC.ThToHs -import RnExpr -import RnEnv -import RnUtils ( HsDocContext(..) ) -import RnFixity ( lookupFixityRn_help ) -import RnTypes +import GHC.Rename.Expr +import GHC.Rename.Env +import GHC.Rename.Utils ( HsDocContext(..) ) +import GHC.Rename.Fixity ( lookupFixityRn_help ) +import GHC.Rename.Types import TcHsSyn import TcSimplify import Type @@ -493,7 +493,7 @@ tcSpliceExpr splice _ 'qAddModFinalizer' of the @Quasi TcM@ instance adds finalizers in the local environment (see Note [Delaying modFinalizers in untyped splices] in -"RnSplice"). Thus after executing the splice, we move the finalizers to the +GHC.Rename.Splice). Thus after executing the splice, we move the finalizers to the finalizer list in the global environment and set them to use the current local environment (with 'addModFinalizersWithLclEnv'). @@ -1089,7 +1089,7 @@ addModFinalizerRef finRef = do RunSplice th_modfinalizers_var -> updTcRef th_modfinalizers_var (finRef :) -- This case happens only if a splice is executed and the caller does -- not set the 'ThStage' to 'RunSplice' to collect finalizers. - -- See Note [Delaying modFinalizers in untyped splices] in RnSplice. + -- See Note [Delaying modFinalizers in untyped splices] in GHC.Rename.Splice. _ -> pprPanic "addModFinalizer was called when no finalizers were collected" (ppr th_stage) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 7fec6f4dd3..9554ef911d 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -43,7 +43,7 @@ import ClsInst( AssocInstInfo(..) ) import TcMType import TysWiredIn ( unitTy, makeRecoveryTyCon ) import TcType -import RnEnv( lookupConstructorFields ) +import GHC.Rename.Env( lookupConstructorFields ) import FamInst import FamInstEnv import Coercion @@ -1715,7 +1715,7 @@ the H98 syntax doesn't permit a kind signature on the newtype itself. There's also a change in the renamer: -* In RnSource.rnTyClDecl, enabling UnliftedNewtypes changes what is means +* In GHC.RenameSource.rnTyClDecl, enabling UnliftedNewtypes changes what is means for a newtype to have a CUSK. This is necessary since UnliftedNewtypes means that, for newtypes without kind signatures, we must use the field inside the data constructor to determine the result kind. @@ -2516,7 +2516,7 @@ tcFamTyPats fam_tc hs_pats ; (fam_app, res_kind) <- unsetWOptM Opt_WarnPartialTypeSignatures $ setXOptM LangExt.PartialTypeSignatures $ -- See Note [Wildcards in family instances] in - -- RnSource.hs + -- GHC.Rename.Source tcInferApps typeLevelMode lhs_fun fun_ty hs_pats ; traceTc "End tcFamTyPats }" $ diff --git a/compiler/types/TyCoFVs.hs b/compiler/types/TyCoFVs.hs index 10dc6453b0..c81c009029 100644 --- a/compiler/types/TyCoFVs.hs +++ b/compiler/types/TyCoFVs.hs @@ -811,7 +811,7 @@ types/kinds are fully settled and zonked. -- -- It is also meant to be stable: that is, variables should not -- be reordered unnecessarily. This is specified in Note [ScopedSort] --- See also Note [Ordering of implicit variables] in RnTypes +-- See also Note [Ordering of implicit variables] in GHC.Rename.Types scopedSort :: [TyCoVar] -> [TyCoVar] scopedSort = go [] [] diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index ea3ef90b49..23ee42fc8a 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -400,7 +400,7 @@ must be True. See also: * [Injectivity annotation] in GHC.Hs.Decls - * [Renaming injectivity annotation] in RnSource + * [Renaming injectivity annotation] in GHC.Rename.Source * [Verifying injectivity annotation] in FamInstEnv * [Type inference for type families with injectivity] in TcInteract diff --git a/utils/haddock b/utils/haddock -Subproject 344cfc239a108258f7caba6f064ccc16c2c0063 +Subproject c67c24fc90e8217c3d2139e99e92889e1df180f |