Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
d491a679
Commit
d491a679
authored
Oct 06, 2019
by
Sylvain Henry
Committed by
Marge Bot
Jan 08, 2020
Browse files
Module hierarchy: Renamer (cf
#13009
)
parent
b69a3460
Pipeline
#14343
failed with stages
in 50 seconds
Changes
47
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
compiler/GHC/Hs/Decls.hs
View file @
d491a679
...
...
@@ -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 (
Rn
Env.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
Rn
Source 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 (
Rn
Source.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 ]
...
...
compiler/GHC/Hs/Expr.hs
View file @
d491a679
...
...
@@ -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
Rn
Expr.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
Rn
Expr.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
Rn
Expr
-- 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
--
Rn
Splice.
--
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
Rn
Splice. 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
Rn
Splice.makePending, HsQuasiQuote case)
(see
GHC.Rename.
Splice.makePending, HsQuasiQuote case)
* cross-stage lifting, where the pending expression expands to
$(lift x)
(see
Rn
Splice.checkCrossStageLifting)
(see
GHC.Rename.
Splice.checkCrossStageLifting)
* Pending pattern splices (UntypedPatSplice), e.g.,
[| \$(f x) -> x |]
...
...
compiler/GHC/Hs/Pat.hs
View file @
d491a679
...
...
@@ -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
Rn
Env.lookupSyntaxName)
(
SyntaxExpr
p
)
-- Name of '-' (see
GHC.Rename.
Env.lookupSyntaxName)
-- ^ n+k pattern
------------ Pattern type signatures ---------------
...
...
compiler/GHC/Hs/Types.hs
View file @
d491a679
...
...
@@ -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
Rn
Types
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
Rn
Types.
(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
Rn
Types
-- 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
Rn
Types, 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.
...
...
compiler/GHC/Hs/Utils.hs
View file @
d491a679
...
...
@@ -239,7 +239,7 @@ nlParPat p = noLoc (ParPat noExtField p)
-------------------------------
-- These are the bits of syntax that contain rebindable names
-- See
Rn
Env.lookupSyntaxName
-- See
GHC.Rename.
Env.lookupSyntaxName
mkHsIntegral
::
IntegralLit
->
HsOverLit
GhcPs
mkHsFractional
::
FractionalLit
->
HsOverLit
GhcPs
...
...
compiler/
r
ename/
Rn
Binds.hs
→
compiler/
GHC/R
ename/Binds.hs
View file @
d491a679
...
...
@@ -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
Rn
Binds
(
module
GHC.Rename.
Binds
(
-- Renaming top-level bindings
rnTopBindsLHS
,
rnTopBindsBoot
,
rnValBindsRHS
,
...
...
@@ -28,18 +28,18 @@ module RnBinds (
import
GhcPrelude
import
{-#
SOURCE
#-
}
Rn
Expr
(
rnLExpr
,
rnStmts
)
import
{-#
SOURCE
#-
}
GHC
.
Rename
.
Expr
(
rnLExpr
,
rnStmts
)
import
GHC.Hs
import
TcRnMonad
import
Rn
Types
import
Rn
Pat
import
Rn
Names
import
Rn
Env
import
Rn
Fixity
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
...
...
compiler/
r
ename/
RnHs
Doc.hs
→
compiler/
GHC/R
ename/Doc.hs
View file @
d491a679
{-# LANGUAGE ViewPatterns #-}
module
RnHs
Doc
(
rnHsDoc
,
rnLHsDoc
,
rnMbLHsDoc
)
where
module
GHC.Rename.
Doc
(
rnHsDoc
,
rnLHsDoc
,
rnMbLHsDoc
)
where
import
GhcPrelude
...
...
compiler/
r
ename/
Rn
Env.hs
→
compiler/
GHC/R
ename/Env.hs
View file @
d491a679
{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-2006
Rn
Env contains functions which convert RdrNames into Names.
GHC.Rename.
Env contains functions which convert RdrNames into Names.
-}
{-# LANGUAGE CPP, MultiWayIf, NamedFieldPuns #-}
module
Rn
Env
(
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
Rn
Unbound
import
Rn
Utils
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
Rn
Names
-- 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
Rn
Env.
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
Rn
Binds.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
Rn
Env.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
Rn
Env.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
Rn
Env.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
Rn
Binds
-- See Note [Renaming pattern synonym variables] in
GHC.Rename.
Binds
lookupLocalOccRn
::
RdrName
->
RnM
Name
lookupLocalOccRn
rdr_name
=
do
{
mb_name
<-
lookupLocalOccRn_maybe
rdr_name
...
...
compiler/
r
ename/
Rn
Expr.hs
→
compiler/
GHC/R
ename/Expr.hs
View file @
d491a679
{-
(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
Rn
Expr
(
module
GHC.Rename.
Expr
(
rnLExpr
,
rnExpr
,
rnStmts
)
where
...
...
@@ -24,23 +24,23 @@ module RnExpr (
import
GhcPrelude
import
Rn
Binds
(
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
Rn
Env
import
Rn
Fixity
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
Rn
Types
import
Rn
Pat
import
GHC.Rename.Unbound
(
reportUnboundName
)
import
GHC.Rename.Splice
(
rnBracket
,
rnSpliceExpr
,
checkThLocalName
)
import
GHC.Rename.
Types
import
GHC.Rename.
Pat
import
DynFlags
import
PrelNames
...
...
compiler/
r
ename/
Rn
Expr.hs-boot
→
compiler/
GHC/R
ename/Expr.hs-boot
View file @
d491a679
module
Rn
Expr
where
module
GHC.Rename.
Expr
where
import
Name
import
GHC.Hs
import
NameSet
(
FreeVars
)
...
...
compiler/
r
ename/
Rn
Fixity.hs
→
compiler/
GHC/R
ename/Fixity.hs
View file @
d491a679
...
...
@@ -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
Rn
Unbound
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
Rn
Names.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
-}
...
...
compiler/
r
ename/
Rn
Names.hs
→
compiler/
GHC/R
ename/Names.hs
View file @
d491a679
{-
(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
Rn
Names
(
module
GHC.Rename.
Names
(
rnImports
,
getLocalNonValBinders
,
newRecordSelector
,
extendGlobalRdrEnvRn
,
gresFromAvails
,
...
...
@@ -35,9 +35,9 @@ import DynFlags
import
TyCoPpr
import
GHC.Hs
import
TcEnv
import
Rn
Env
import
Rn
Fixity
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
Rn
Env
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
Rn
Env.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
Rn
Env.
hs.
-- Exact RdrNames] in
GHC.Rename.
Env.
|
otherwise
=
mkRdrUnqual
(
flSelector
qualFieldLbl
)
{-
...
...
compiler/
r
ename/
Rn
Pat.hs
→
compiler/
GHC/R
ename/Pat.hs
View file @
d491a679
{-
(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
Rn
Pat
(
-- 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
#-
}
Rn
Expr
(
rnLExpr
)
import
{-#
SOURCE
#-
}
Rn
Splice
(
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
Rn
Env
import
Rn
Fixity
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
Rn
Types
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
Rn
Source
.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
Rn
Splice
;
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
}
...
...
compiler/
r
ename/
Rn
Source.hs
→
compiler/
GHC/R
ename/Source.hs
View file @
d491a679
{-
(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
Rn
Source
(
module
GHC.Rename.
Source
(
rnSrcDecls
,
addTcgDUs
,
findSplice
)
where
...
...
@@ -18,23 +18,23 @@ module RnSource (
import
GhcPrelude
import
{-#
SOURCE
#-
}
Rn
Expr
(
rnLExpr
)
import
{-#
SOURCE
#-
}
Rn
Splice
(
rnSpliceDecl
,
rnTopSpliceDecls
)
import
{-#
SOURCE
#-
}
GHC
.
Rename
.
Expr
(
rnLExpr
)
import
{-#
SOURCE
#-
}
GHC
.
Rename
.
Splice
(
rnSpliceDecl
,
rnTopSpliceDecls
)
import
GHC.Hs
import
FieldLabel
import
RdrName
import
Rn
Types
import
Rn
Binds
import
Rn
Env
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
Rn
Names
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
Rn
Names.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
Rn
Names.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
Rn
Names.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
Rn
Names.extendGlobalRdrEnvRn
-- since that is done by
GHC.Rename.
Names.extendGlobalRdrEnvRn
;
return
(
RecCon
(
L
l
new_fields
),
fvs
)
}
-------------------------------------------------
...
...
compiler/
r
ename/
Rn
Splice.hs
→
compiler/
GHC/R
ename/Splice.hs
View file @
d491a679
...
...
@@ -2,7 +2,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
module
Rn
Splice
(
module
GHC.Rename.
Splice
(
rnTopSpliceDecls
,
rnSpliceType
,
rnSpliceExpr
,
rnSplicePat
,
rnSpliceDecl
,
rnBracket
,
...
...
@@ -20,20 +20,20 @@ import GHC.Hs
import
RdrName
import
TcRnMonad
import
Rn
Env
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
#-
}
Rn
Expr
(
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