[commit: ghc] master: Extra ASSERTs for nameModule (1267048)

git at git.haskell.org git at git.haskell.org
Tue Jul 5 12:50:56 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1267048e1785eb4f05834ec56e30107cda4828bd/ghc

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

commit 1267048e1785eb4f05834ec56e30107cda4828bd
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Jul 4 18:34:12 2016 +0100

    Extra ASSERTs for nameModule


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

1267048e1785eb4f05834ec56e30107cda4828bd
 compiler/basicTypes/RdrName.hs | 2 +-
 compiler/main/HscTypes.hs      | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs
index 592ee92..d6a8aa6 100644
--- a/compiler/basicTypes/RdrName.hs
+++ b/compiler/basicTypes/RdrName.hs
@@ -1142,7 +1142,7 @@ ppr_defn_site imp_spec name
                 2 (pprLoc loc)
   where
     loc = nameSrcSpan name
-    defining_mod = nameModule name
+    defining_mod = ASSERT2( isExternalName name, ppr name ) nameModule name
     same_module = importSpecModule imp_spec == moduleName defining_mod
     pp_mod | same_module = empty
            | otherwise   = text "in" <+> quotes (ppr defining_mod)
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index a3352f4..b71e8ae 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -1650,7 +1650,8 @@ mkPrintUnqualified dflags env = QueryQualify qual_name
                             -- Eg  f = True; g = 0; f = False
       where
         is_name :: Name -> Bool
-        is_name name = nameModule name == mod && nameOccName name == occ
+        is_name name = ASSERT2( isExternalName name, ppr name )
+                       nameModule name == mod && nameOccName name == occ
 
         forceUnqualNames :: [Name]
         forceUnqualNames =



More information about the ghc-commits mailing list