[commit: ghc] wip/rwbarton-D2992: Fix implementation of nameIsHomePackage (da3bace)

git at git.haskell.org git at git.haskell.org
Fri Feb 10 15:45:01 UTC 2017


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

On branch  : wip/rwbarton-D2992
Link       : http://ghc.haskell.org/trac/ghc/changeset/da3baceeb0df05fd60ef2f0a38f0202a4828fd91/ghc

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

commit da3baceeb0df05fd60ef2f0a38f0202a4828fd91
Author: Reid Barton <rwbarton at gmail.com>
Date:   Thu Feb 9 15:14:58 2017 -0500

    Fix implementation of nameIsHomePackage


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

da3baceeb0df05fd60ef2f0a38f0202a4828fd91
 compiler/basicTypes/Name.hs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs
index 7cb2939..5d47613 100644
--- a/compiler/basicTypes/Name.hs
+++ b/compiler/basicTypes/Name.hs
@@ -273,9 +273,11 @@ nameIsLocalOrFrom from name
 nameIsHomePackage :: Module -> Name -> Bool
 -- True if the Name is defined in module of this package
 nameIsHomePackage this_mod
-  = \nm -> case nameModule_maybe nm of
-              Nothing -> False
-              Just nm_mod -> moduleUnitId nm_mod == this_pkg
+  = \nm -> case n_sort nm of
+              External nm_mod    -> moduleUnitId nm_mod == this_pkg
+              WiredIn nm_mod _ _ -> moduleUnitId nm_mod == this_pkg
+              Internal -> True
+              System   -> False
   where
     this_pkg = moduleUnitId this_mod
 



More information about the ghc-commits mailing list