Commit d491a679 authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Module hierarchy: Renamer (cf #13009)

parent b69a3460
Pipeline #14343 failed with stages
in 50 seconds
...@@ -383,7 +383,7 @@ Plan of attack: ...@@ -383,7 +383,7 @@ Plan of attack:
(See RnHiFiles.getSysBinders) (See RnHiFiles.getSysBinders)
- When typechecking the decl, we build the implicit TyCons and Ids. - 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 to ensure correct module and provenance is set
These are the two places that we have to conjure up the magic derived These are the two places that we have to conjure up the magic derived
...@@ -908,7 +908,7 @@ Invariants ...@@ -908,7 +908,7 @@ Invariants
ones. ones.
See Note [Dependency analsis of type, class, and instance decls] 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 -- | Type or Class Group
...@@ -1412,7 +1412,7 @@ There's a wrinkle in ConDeclGADT ...@@ -1412,7 +1412,7 @@ There's a wrinkle in ConDeclGADT
con_args = PrefixCon [] con_args = PrefixCon []
con_res_ty = a :*: (b -> (a :*: (b -> (a :+: b)))) 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 operator fixities are sorted. So we generate. So we end
up with up with
con_args = PrefixCon [ a :*: b, a :*: b ] con_args = PrefixCon [ a :*: b, a :*: b ]
......
...@@ -179,7 +179,7 @@ This is Less Cool than what we normally do for rebindable syntax, which is to ...@@ -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 make fully-instantiated piece of evidence at every use site. The Cmd way
is Less Cool because is Less Cool because
* The renamer has to predict which methods are needed. * 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 * The desugarer has to know the polymorphic type of the instantiated
method. This is checked by Inst.tcSyntaxName, but is less flexible method. This is checked by Inst.tcSyntaxName, but is less flexible
...@@ -1748,7 +1748,7 @@ type GhciStmt id = Stmt id (LHsExpr id) ...@@ -1748,7 +1748,7 @@ type GhciStmt id = Stmt id (LHsExpr id)
-- For details on above see note [Api annotations] in ApiAnnotation -- For details on above see note [Api annotations] in ApiAnnotation
data StmtLR idL idR body -- body should always be (LHs**** idR) data StmtLR idL idR body -- body should always be (LHs**** idR)
= LastStmt -- Always the last Stmt in ListComp, MonadComp, = 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 -- Not used for GhciStmtCtxt, PatGuard, which scope over other stuff
(XLastStmt idL idR body) (XLastStmt idL idR body)
body body
...@@ -1776,7 +1776,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR) ...@@ -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 -- appropriate applicative expression by the desugarer, but it is intended
-- to be invisible in error messages. -- 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 | ApplicativeStmt
(XApplicativeStmt idL idR body) -- Post typecheck, Type of the body (XApplicativeStmt idL idR body) -- Post typecheck, Type of the body
...@@ -2297,7 +2297,7 @@ data HsSplice id ...@@ -2297,7 +2297,7 @@ data HsSplice id
-- AZ:TODO: use XSplice instead of HsSpliced -- AZ:TODO: use XSplice instead of HsSpliced
| HsSpliced -- See Note [Delaying modFinalizers in untyped splices] in | 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 -- This is the result of splicing a splice. It is produced by
-- the renamer and consumed by the typechecker. It lives only -- the renamer and consumed by the typechecker. It lives only
-- between the two. -- between the two.
...@@ -2333,7 +2333,7 @@ isTypedSplice _ = False -- Quasi-quotes are untyped splices ...@@ -2333,7 +2333,7 @@ isTypedSplice _ = False -- Quasi-quotes are untyped splices
-- | Finalizers produced by a splice with -- | Finalizers produced by a splice with
-- 'Language.Haskell.TH.Syntax.addModFinalizer' -- '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. -- this is used.
-- --
newtype ThModFinalizers = ThModFinalizers [ForeignRef (TH.Q ())] newtype ThModFinalizers = ThModFinalizers [ForeignRef (TH.Q ())]
...@@ -2421,11 +2421,11 @@ distinguished by their UntypedSpliceFlavour ...@@ -2421,11 +2421,11 @@ distinguished by their UntypedSpliceFlavour
UntypedExpSplice is also used for UntypedExpSplice is also used for
* quasi-quotes, where the pending expression expands to * quasi-quotes, where the pending expression expands to
$(quoter "...blah...") $(quoter "...blah...")
(see RnSplice.makePending, HsQuasiQuote case) (see GHC.Rename.Splice.makePending, HsQuasiQuote case)
* cross-stage lifting, where the pending expression expands to * cross-stage lifting, where the pending expression expands to
$(lift x) $(lift x)
(see RnSplice.checkCrossStageLifting) (see GHC.Rename.Splice.checkCrossStageLifting)
* Pending pattern splices (UntypedPatSplice), e.g., * Pending pattern splices (UntypedPatSplice), e.g.,
[| \$(f x) -> x |] [| \$(f x) -> x |]
......
...@@ -245,7 +245,7 @@ data Pat p ...@@ -245,7 +245,7 @@ data Pat p
-- a new hs-boot file. Not worth it. -- a new hs-boot file. Not worth it.
(SyntaxExpr p) -- (>=) function, of type t1->t2->Bool (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 -- ^ n+k pattern
------------ Pattern type signatures --------------- ------------ Pattern type signatures ---------------
......
...@@ -144,7 +144,7 @@ Then we use a LHsBndrSig on the binder, so that the ...@@ -144,7 +144,7 @@ Then we use a LHsBndrSig on the binder, so that the
renamer can decorate it with the variables bound renamer can decorate it with the variables bound
by the pattern ('a' in the first example, 'k' in the second), by the pattern ('a' in the first example, 'k' in the second),
assuming that neither of them is in scope already 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] Note [HsType binders]
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
...@@ -265,7 +265,7 @@ By "stable", we mean that any two variables who do not depend on each other ...@@ -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. preserve their existing left-to-right ordering.
Implicitly bound variables are collected by the extract- family of functions 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. These functions thus promise to keep left-to-right ordering.
Look for pointers to this note to see the places where the action happens. 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] ...@@ -368,7 +368,7 @@ data HsImplicitBndrs pass thing -- See Note [HsType binders]
-- Implicitly-bound kind & type vars -- Implicitly-bound kind & type vars
-- Order is important; see -- Order is important; see
-- Note [Ordering of implicit variables] -- Note [Ordering of implicit variables]
-- in RnTypes -- in GHC.Rename.Types
, hsib_body :: thing -- Main payload (type or list of types) , hsib_body :: thing -- Main payload (type or list of types)
} }
...@@ -602,7 +602,8 @@ data HsType pass ...@@ -602,7 +602,8 @@ data HsType pass
| HsParTy (XParTy pass) | HsParTy (XParTy pass)
(LHsType pass) -- See Note [Parens in HsSyn] in GHC.Hs.Expr (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! -- It's important that a * (b + c) doesn't get rearranged to (a*b) + c!
-- ^ - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnOpen' @'('@, -- ^ - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnOpen' @'('@,
-- 'ApiAnnotation.AnnClose' @')'@ -- 'ApiAnnotation.AnnClose' @')'@
...@@ -774,7 +775,7 @@ After renaming ...@@ -774,7 +775,7 @@ After renaming
Qualified currently behaves exactly as Implicit, Qualified currently behaves exactly as Implicit,
but it is deprecated to use it for implicit quantification. but it is deprecated to use it for implicit quantification.
In this case, GHC 7.10 gives a warning; see 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 In GHC 8.0, Qualified will no longer bind variables
and this will become an error. and this will become an error.
......
...@@ -239,7 +239,7 @@ nlParPat p = noLoc (ParPat noExtField p) ...@@ -239,7 +239,7 @@ nlParPat p = noLoc (ParPat noExtField p)
------------------------------- -------------------------------
-- These are the bits of syntax that contain rebindable names -- These are the bits of syntax that contain rebindable names
-- See RnEnv.lookupSyntaxName -- See GHC.Rename.Env.lookupSyntaxName
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
mkHsFractional :: FractionalLit -> HsOverLit GhcPs mkHsFractional :: FractionalLit -> HsOverLit GhcPs
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{- {-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998 (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 This module does renaming and dependency analysis on value bindings in
the abstract syntax. It does {\em not} do cycle-checks on class or 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 ...@@ -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). they may be affected by renaming (which isn't fully worked out yet).
-} -}
module RnBinds ( module GHC.Rename.Binds (
-- Renaming top-level bindings -- Renaming top-level bindings
rnTopBindsLHS, rnTopBindsBoot, rnValBindsRHS, rnTopBindsLHS, rnTopBindsBoot, rnValBindsRHS,
...@@ -28,18 +28,18 @@ module RnBinds ( ...@@ -28,18 +28,18 @@ module RnBinds (
import GhcPrelude import GhcPrelude
import {-# SOURCE #-} RnExpr( rnLExpr, rnStmts ) import {-# SOURCE #-} GHC.Rename.Expr( rnLExpr, rnStmts )
import GHC.Hs import GHC.Hs
import TcRnMonad import TcRnMonad
import RnTypes import GHC.Rename.Types
import RnPat import GHC.Rename.Pat
import RnNames import GHC.Rename.Names
import RnEnv import GHC.Rename.Env
import RnFixity import GHC.Rename.Fixity
import RnUtils ( HsDocContext(..), mapFvRn, extendTyVarEnvFVRn import GHC.Rename.Utils ( HsDocContext(..), mapFvRn, extendTyVarEnvFVRn
, checkDupRdrNames, warnUnusedLocalBinds, , checkDupRdrNames, warnUnusedLocalBinds
checkUnusedRecordWildcard , checkUnusedRecordWildcard
, checkDupAndShadowedNames, bindLocalNamesFV ) , checkDupAndShadowedNames, bindLocalNamesFV )
import DynFlags import DynFlags
import Module import Module
......
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ViewPatterns #-}
module RnHsDoc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where module GHC.Rename.Doc ( rnHsDoc, rnLHsDoc, rnMbLHsDoc ) where
import GhcPrelude import GhcPrelude
......
{- {-
(c) The GRASP/AQUA Project, Glasgow University, 1992-2006 (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 #-} {-# LANGUAGE CPP, MultiWayIf, NamedFieldPuns #-}
module RnEnv ( module GHC.Rename.Env (
newTopSrcBinder, newTopSrcBinder,
lookupLocatedTopBndrRn, lookupTopBndrRn, lookupLocatedTopBndrRn, lookupTopBndrRn,
lookupLocatedOccRn, lookupOccRn, lookupOccRn_maybe, lookupLocatedOccRn, lookupOccRn, lookupOccRn_maybe,
...@@ -76,8 +76,8 @@ import FastString ...@@ -76,8 +76,8 @@ import FastString
import Control.Monad import Control.Monad
import ListSetOps ( minusList ) import ListSetOps ( minusList )
import qualified GHC.LanguageExtensions as LangExt import qualified GHC.LanguageExtensions as LangExt
import RnUnbound import GHC.Rename.Unbound
import RnUtils import GHC.Rename.Utils
import qualified Data.Semigroup as Semi import qualified Data.Semigroup as Semi
import Data.Either ( partitionEithers ) import Data.Either ( partitionEithers )
import Data.List (find) import Data.List (find)
...@@ -201,7 +201,7 @@ newTopSrcBinder (L loc rdr_name) ...@@ -201,7 +201,7 @@ newTopSrcBinder (L loc rdr_name)
; stage <- getStage ; stage <- getStage
; if isBrackStage stage then ; if isBrackStage stage then
-- We are inside a TH bracket, so make an *Internal* name -- 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 do { uniq <- newUnique
; return (mkInternalName uniq (rdrNameOcc rdr_name) loc) } ; return (mkInternalName uniq (rdrNameOcc rdr_name) loc) }
else else
...@@ -217,7 +217,7 @@ newTopSrcBinder (L loc rdr_name) ...@@ -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] Note [Type and class operator definitions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -393,7 +393,7 @@ lookupFamInstName :: Maybe Name -> Located RdrName ...@@ -393,7 +393,7 @@ lookupFamInstName :: Maybe Name -> Located RdrName
-> RnM (Located Name) -> RnM (Located Name)
-- Used for TyData and TySynonym family instances only, -- Used for TyData and TySynonym family instances only,
-- See Note [Family instance binders] -- 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 = wrapLocM (lookupInstDeclBndr cls (text "associated type")) tc_rdr
lookupFamInstName Nothing tc_rdr -- Family instance; tc_rdr is an *occurrence* lookupFamInstName Nothing tc_rdr -- Family instance; tc_rdr is an *occurrence*
= lookupLocatedOccRn tc_rdr = lookupLocatedOccRn tc_rdr
...@@ -795,19 +795,19 @@ These System names are generated by Convert.thRdrName ...@@ -795,19 +795,19 @@ These System names are generated by Convert.thRdrName
But, constructors and the like need External Names, not System Names! But, constructors and the like need External Names, not System Names!
So we do the following 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 non-External Name, and make an External name for it. This is
the name that goes in the GlobalRdrEnv the name that goes in the GlobalRdrEnv
* When looking up an occurrence of an Exact name, done in * 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 GlobalRdrEnv, and use the one from the envt -- it will be an
External Name in the case of the data type/constructor above. External Name in the case of the data type/constructor above.
* Exact names are also use for purely local binders generated * Exact names are also use for purely local binders generated
by TH, such as \x_33. x_33 by TH, such as \x_33. x_33
Both binder and occurrence are Exact RdrNames. The occurrence 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 misses, because lookupLocalRdrEnv always returns Nothing for
an Exact Name. Now we fall through to lookupExactOcc, which an Exact Name. Now we fall through to lookupExactOcc, which
will find the Name is not in the GlobalRdrEnv, so we just use will find the Name is not in the GlobalRdrEnv, so we just use
...@@ -905,7 +905,7 @@ lookupOccRn rdr_name ...@@ -905,7 +905,7 @@ lookupOccRn rdr_name
Nothing -> reportUnboundName rdr_name } Nothing -> reportUnboundName rdr_name }
-- Only used in one place, to rename pattern synonym binders. -- 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 :: RdrName -> RnM Name
lookupLocalOccRn rdr_name lookupLocalOccRn rdr_name
= do { mb_name <- lookupLocalOccRn_maybe rdr_name = do { mb_name <- lookupLocalOccRn_maybe rdr_name
......
{- {-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section[RnExpr]{Renaming of expressions} Renaming of expressions
Basically dependency analysis. Basically dependency analysis.
...@@ -16,7 +16,7 @@ free variables. ...@@ -16,7 +16,7 @@ free variables.
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ViewPatterns #-}
module RnExpr ( module GHC.Rename.Expr (
rnLExpr, rnExpr, rnStmts rnLExpr, rnExpr, rnStmts
) where ) where
...@@ -24,23 +24,23 @@ module RnExpr ( ...@@ -24,23 +24,23 @@ module RnExpr (
import GhcPrelude import GhcPrelude
import RnBinds ( rnLocalBindsAndThen, rnLocalValBindsLHS, rnLocalValBindsRHS, import GHC.Rename.Binds ( rnLocalBindsAndThen, rnLocalValBindsLHS, rnLocalValBindsRHS
rnMatchGroup, rnGRHS, makeMiniFixityEnv) , rnMatchGroup, rnGRHS, makeMiniFixityEnv)
import GHC.Hs import GHC.Hs
import TcEnv ( isBrackStage ) import TcEnv ( isBrackStage )
import TcRnMonad import TcRnMonad
import Module ( getModule ) import Module ( getModule )
import RnEnv import GHC.Rename.Env
import RnFixity import GHC.Rename.Fixity
import RnUtils ( HsDocContext(..), bindLocalNamesFV, checkDupNames import GHC.Rename.Utils ( HsDocContext(..), bindLocalNamesFV, checkDupNames
, bindLocalNames , bindLocalNames
, mapMaybeFvRn, mapFvRn , mapMaybeFvRn, mapFvRn
, warnUnusedLocalBinds, typeAppErr , warnUnusedLocalBinds, typeAppErr
, checkUnusedRecordWildcard ) , checkUnusedRecordWildcard )
import RnUnbound ( reportUnboundName ) import GHC.Rename.Unbound ( reportUnboundName )
import RnSplice ( rnBracket, rnSpliceExpr, checkThLocalName ) import GHC.Rename.Splice ( rnBracket, rnSpliceExpr, checkThLocalName )
import RnTypes import GHC.Rename.Types
import RnPat import GHC.Rename.Pat
import DynFlags import DynFlags
import PrelNames import PrelNames
......
module RnExpr where module GHC.Rename.Expr where
import Name import Name
import GHC.Hs import GHC.Hs
import NameSet ( FreeVars ) import NameSet ( FreeVars )
......
...@@ -6,10 +6,15 @@ This module contains code which maintains and manipulates the ...@@ -6,10 +6,15 @@ This module contains code which maintains and manipulates the
fixity environment during renaming. fixity environment during renaming.
-} -}
module RnFixity ( MiniFixityEnv, module GHC.Rename.Fixity
addLocalFixities, ( MiniFixityEnv
lookupFixityRn, lookupFixityRn_help, , addLocalFixities
lookupFieldFixityRn, lookupTyFixityRn ) where , lookupFixityRn
, lookupFixityRn_help
, lookupFieldFixityRn
, lookupTyFixityRn
)
where
import GhcPrelude import GhcPrelude
...@@ -28,7 +33,7 @@ import Outputable ...@@ -28,7 +33,7 @@ import Outputable
import Maybes import Maybes
import Data.List import Data.List
import Data.Function ( on ) import Data.Function ( on )
import RnUnbound import GHC.Rename.Unbound
{- {-
********************************************************* *********************************************************
...@@ -97,7 +102,7 @@ lookupFixity is a bit strange. ...@@ -97,7 +102,7 @@ lookupFixity is a bit strange.
* Top-level fixity decls in this module may be for Names that are * Top-level fixity decls in this module may be for Names that are
either Global (constructors, class operations) either Global (constructors, class operations)
or Local/Exported (everything else) 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 We put them all in the local fixity environment
-} -}
......
{- {-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998 (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 #-} {-# LANGUAGE CPP, NondecreasingIndentation, MultiWayIf, NamedFieldPuns #-}
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
module RnNames ( module GHC.Rename.Names (
rnImports, getLocalNonValBinders, newRecordSelector, rnImports, getLocalNonValBinders, newRecordSelector,
extendGlobalRdrEnvRn, extendGlobalRdrEnvRn,
gresFromAvails, gresFromAvails,
...@@ -35,9 +35,9 @@ import DynFlags ...@@ -35,9 +35,9 @@ import DynFlags
import TyCoPpr import TyCoPpr
import GHC.Hs import GHC.Hs
import TcEnv import TcEnv
import RnEnv import GHC.Rename.Env
import RnFixity import GHC.Rename.Fixity
import RnUtils ( warnUnusedTopBinds, mkFieldEnv ) import GHC.Rename.Utils ( warnUnusedTopBinds, mkFieldEnv )
import GHC.Iface.Load ( loadSrcInterface ) import GHC.Iface.Load ( loadSrcInterface )
import TcRnMonad import TcRnMonad
import PrelNames import PrelNames
...@@ -504,7 +504,7 @@ created by its bindings. ...@@ -504,7 +504,7 @@ created by its bindings.
Note [Top-level Names in Template Haskell decl quotes] Note [Top-level Names in Template Haskell decl quotes]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See also: Note [Interactively-bound Ids in GHCi] in HscTypes 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: Consider a Template Haskell declaration quotation like this:
module M where module M where
...@@ -513,7 +513,7 @@ When renaming the declarations inside [d| ...|], we treat the ...@@ -513,7 +513,7 @@ When renaming the declarations inside [d| ...|], we treat the
top level binders specially in two ways top level binders specially in two ways
1. We give them an Internal Name, not (as usual) an External one. 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. 2. We make them *shadow* the outer bindings.
See Note [GlobalRdrEnv shadowing] See Note [GlobalRdrEnv shadowing]
...@@ -797,7 +797,7 @@ newRecordSelector overload_ok (dc:_) (L loc (FieldOcc _ (L _ fld))) ...@@ -797,7 +797,7 @@ newRecordSelector overload_ok (dc:_) (L loc (FieldOcc _ (L _ fld)))
-- sites. This is needed to correctly support record -- sites. This is needed to correctly support record
-- selectors in Template Haskell. See Note [Binders in -- selectors in Template Haskell. See Note [Binders in
-- Template Haskell] in Convert.hs and Note [Looking up -- Template Haskell] in Convert.hs and Note [Looking up
-- Exact RdrNames] in RnEnv.hs. -- Exact RdrNames] in GHC.Rename.Env.
| otherwise = mkRdrUnqual (flSelector qualFieldLbl) | otherwise = mkRdrUnqual (flSelector qualFieldLbl)
{- {-
......
{- {-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section[RnPat]{Renaming of patterns} Renaming of patterns
Basically dependency analysis. Basically dependency analysis.
...@@ -18,7 +18,7 @@ free variables. ...@@ -18,7 +18,7 @@ free variables.
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveFunctor #-}
module RnPat (-- main entry points module GHC.Rename.Pat (-- main entry points
rnPat, rnPats, rnBindPat, rnPatAndThen, rnPat, rnPats, rnBindPat, rnPatAndThen,
NameMaker, applyNameMaker, -- a utility for making names: NameMaker, applyNameMaker, -- a utility for making names:
...@@ -43,22 +43,22 @@ module RnPat (-- main entry points ...@@ -43,22 +43,22 @@ module RnPat (-- main entry points
import GhcPrelude import GhcPrelude
import {-# SOURCE #-} RnExpr ( rnLExpr ) import {-# SOURCE #-} GHC.Rename.Expr ( rnLExpr )
import {-# SOURCE #-} RnSplice ( rnSplicePat ) import {-# SOURCE #-} GHC.Rename.Splice ( rnSplicePat )
#include "HsVersions.h" #include "HsVersions.h"
import GHC.Hs import GHC.Hs
import TcRnMonad import TcRnMonad
import TcHsSyn ( hsOverLitName ) import TcHsSyn ( hsOverLitName )
import RnEnv import GHC.Rename.Env
import RnFixity import GHC.Rename.Fixity
import RnUtils ( HsDocContext(..), newLocalBndrRn, bindLocalNames import GHC.Rename.Utils ( HsDocContext(..), newLocalBndrRn, bindLocalNames
, warnUnusedMatches, newLocalBndrRn , warnUnusedMatches, newLocalBndrRn
, checkUnusedRecordWildcard , checkUnusedRecordWildcard
, checkDupNames, checkDupAndShadowedNames , checkDupNames, checkDupAndShadowedNames
, checkTupSize , unknownSubordinateErr ) , checkTupSize , unknownSubordinateErr )
import RnTypes import GHC.Rename.Types
import PrelNames import PrelNames
import Name import Name
import NameSet import NameSet
...@@ -246,7 +246,7 @@ newPatName (LetMk is_top fix_env) rdr_name ...@@ -246,7 +246,7 @@ newPatName (LetMk is_top fix_env) rdr_name
-- however, this binding seems to work, and it only exists for -- however, this binding seems to work, and it only exists for
-- the duration of the patterns and the continuation; -- the duration of the patterns and the continuation;
-- then the top-level name is added to the global env -- 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] Note [View pattern usage]
...@@ -498,7 +498,7 @@ rnPatAndThen mk (SplicePat x (HsSpliced x2 mfs (HsSplicedPat pat))) ...@@ -498,7 +498,7 @@ rnPatAndThen mk (SplicePat x (HsSpliced x2 mfs (HsSplicedPat pat)))
rnPatAndThen mk (SplicePat _ splice) rnPatAndThen mk (SplicePat _ splice)
= do { eith <- liftCpsFV $ rnSplicePat splice