[commit: ghc] ghc-8.0: Teach lookupLocalRdrEnv about Exacts. (#11813) (ead6998)

git at git.haskell.org git at git.haskell.org
Sat Apr 16 18:40:01 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/ead6998f9944112879b2ab322a25495bbc557a42/ghc

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

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

    Teach lookupLocalRdrEnv about Exacts. (#11813)
    
    (cherry picked from commit d81cdc227cd487659995ddea577214314c9b4b97)


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

ead6998f9944112879b2ab322a25495bbc557a42
 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 febd718..50049ab 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