summaryrefslogtreecommitdiff
path: root/compiler/rename/RnEnv.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-10-10 12:01:14 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2016-10-08 00:20:34 -0700
commit00b530d5402aaa37e4085ecdcae0ae54454736c1 (patch)
tree2d2963db4abdbcba9c12aea13a26e29e718e4778 /compiler/rename/RnEnv.hs
parent887485a45ae55e81b26b6412b6f9dcf6a497f044 (diff)
downloadhaskell-00b530d5402aaa37e4085ecdcae0ae54454736c1.tar.gz
The Backpack patch.
Summary: This patch implements Backpack for GHC. It's a big patch but I've tried quite hard to keep things, by-in-large, self-contained. The user facing specification for Backpack can be found at: https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst A guide to the implementation can be found at: https://github.com/ezyang/ghc-proposals/blob/backpack-impl/proposals/0000-backpack-impl.rst Has a submodule update for Cabal, as well as a submodule update for filepath to handle more strict checking of cabal-version. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, simonmar, bgamari, goldfire Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D1482
Diffstat (limited to 'compiler/rename/RnEnv.hs')
-rw-r--r--compiler/rename/RnEnv.hs40
1 files changed, 12 insertions, 28 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index b1cb7fe064..d41e9ef48e 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -208,40 +208,16 @@ newTopSrcBinder (L loc rdr_name)
-- module name, we we get a confusing "M.T is not in scope" error later
; stage <- getStage
- ; env <- getGblEnv
; 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
do { uniq <- newUnique
; return (mkInternalName uniq (rdrNameOcc rdr_name) loc) }
- else case tcg_impl_rdr_env env of
- Just gr ->
- -- We're compiling --sig-of, so resolve with respect to this
- -- module.
- -- See Note [Signature parameters in TcGblEnv and DynFlags]
- do { case lookupGlobalRdrEnv gr (rdrNameOcc rdr_name) of
- -- Be sure to override the loc so that we get accurate
- -- information later
- [GRE{ gre_name = n }] -> do
- -- NB: Just adding this line will not work:
- -- addUsedGRE True gre
- -- see Note [Signature lazy interface loading] for
- -- more details.
- return (setNameLoc n loc)
- _ -> do
- { -- NB: cannot use reportUnboundName rdr_name
- -- because it looks up in the wrong RdrEnv
- -- ToDo: more helpful error messages
- ; addErr (unknownNameErr (pprNonVarNameSpace
- (occNameSpace (rdrNameOcc rdr_name))) rdr_name)
- ; return (mkUnboundNameRdr rdr_name)
- }
- }
- Nothing ->
- -- Normal case
+ else
do { this_mod <- getModule
; traceRn (text "newTopSrcBinder" <+> (ppr this_mod $$ ppr rdr_name $$ ppr loc))
- ; newGlobalBinder this_mod (rdrNameOcc rdr_name) loc } }
+ ; newGlobalBinder this_mod (rdrNameOcc rdr_name) loc }
+ }
{-
*********************************************************
@@ -1216,6 +1192,14 @@ data HsSigCtxt
| RoleAnnotCtxt NameSet -- A role annotation, with the names of all types
-- in the group
+instance Outputable HsSigCtxt where
+ ppr (TopSigCtxt ns) = text "TopSigCtxt" <+> ppr ns
+ ppr (LocalBindCtxt ns) = text "LocalBindCtxt" <+> ppr ns
+ ppr (ClsDeclCtxt n) = text "ClsDeclCtxt" <+> ppr n
+ ppr (InstDeclCtxt ns) = text "InstDeclCtxt" <+> ppr ns
+ ppr (HsBootCtxt ns) = text "HsBootCtxt" <+> ppr ns
+ ppr (RoleAnnotCtxt ns) = text "RoleAnnotCtxt" <+> ppr ns
+
lookupSigOccRn :: HsSigCtxt
-> Sig RdrName
-> Located RdrName -> RnM (Located Name)
@@ -1398,7 +1382,7 @@ lookupFixity is a bit strange.
* Nested local fixity decls are put in the local fixity env, which we
find with getFixtyEnv
-* Imported fixities are found in the HIT or PIT
+* Imported fixities are found in the PIT
* Top-level fixity decls in this module may be for Names that are
either Global (constructors, class operations)