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

git at git.haskell.org git at git.haskell.org
Fri Apr 8 09:38:12 UTC 2016


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

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

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

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

    Teach lookupLocalRdrEnv about Exacts. (#11813)


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

254aad24b6e05928477d4d16108b0e12bcc89f4f
 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 62f473e..282628a 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