[commit: ghc] master: Teach lookupLocalRdrEnv about Exacts. (#11813) (d81cdc2)
git at git.haskell.org
git at git.haskell.org
Tue Apr 12 12:12:01 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d81cdc227cd487659995ddea577214314c9b4b97/ghc
>---------------------------------------------------------------
commit d81cdc227cd487659995ddea577214314c9b4b97
Author: Richard Eisenberg <eir at cis.upenn.edu>
Date: Fri Apr 8 08:01:34 2016 +0200
Teach lookupLocalRdrEnv about Exacts. (#11813)
>---------------------------------------------------------------
d81cdc227cd487659995ddea577214314c9b4b97
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