[commit: ghc] wip/rae: Teach lookupLocalRdrEnv about Exacts. (#11813) (be7b3f0)

git at git.haskell.org git at git.haskell.org
Mon Apr 11 19:45:48 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/be7b3f059c9acf864fac867fe4de5f7f1e159998/ghc

>---------------------------------------------------------------

commit be7b3f059c9acf864fac867fe4de5f7f1e159998
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date:   Fri Apr 8 08:01:34 2016 +0200

    Teach lookupLocalRdrEnv about Exacts. (#11813)


>---------------------------------------------------------------

be7b3f059c9acf864fac867fe4de5f7f1e159998
 compiler/basicTypes/RdrName.hs | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs
index fec5411..d259726 100644
--- a/compiler/basicTypes/RdrName.hs
+++ b/compiler/basicTypes/RdrName.hs
@@ -357,8 +357,17 @@ extendLocalRdrEnvList lre@(LRE { lre_env = env, lre_in_scope = ns }) names
         , lre_in_scope = extendNameSetList ns names }
 
 lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name
-lookupLocalRdrEnv (LRE { lre_env = env }) (Unqual occ) = lookupOccEnv env occ
-lookupLocalRdrEnv _                       _            = Nothing
+lookupLocalRdrEnv (LRE { lre_env = env, lre_in_scope = ns }) rdr
+  | Unqual occ <- rdr
+  = lookupOccEnv env occ
+
+  -- See Note [Local bindings with Exact Names]
+  | Exact name <- rdr
+  , name `elemNameSet` ns
+  = Just name
+
+  | otherwise
+  = Nothing
 
 lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name
 lookupLocalRdrOcc (LRE { lre_env = env }) occ = lookupOccEnv env occ



More information about the ghc-commits mailing list