Add ASSERTs to all calls of nameModule
[ghc-hetmet.git] / compiler / iface / IfaceEnv.lhs
index 86f43cb..20d7327 100644 (file)
@@ -1,13 +1,6 @@
 (c) The University of Glasgow 2002-2006
 
 \begin{code}
-{-# OPTIONS -w #-}
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and fix
--- any warnings in the module. See
---     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
--- for details
-
 module IfaceEnv (
        newGlobalBinder, newIPName, newImplicitBinder, 
        lookupIfaceTop,
@@ -191,12 +184,17 @@ newIPName occ_name_ip = do
        key = occ_name_ip       -- Ensures that ?x and %x get distinct Names
 \end{code}
 
-       Local helper functions (not exported)
+%************************************************************************
+%*                                                                     *
+               Name cache access
+%*                                                                     *
+%************************************************************************
 
 \begin{code}
 lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name
-lookupOrigNameCache nc mod occ
-  | mod == dATA_TUP || mod == gHC_PRIM,                -- Boxed tuples from one, 
+lookupOrigNameCache _ mod occ
+  -- XXX Why is gHC_UNIT not mentioned here?
+  | mod == gHC_TUPLE || mod == gHC_PRIM,               -- Boxed tuples from one, 
     Just tup_info <- isTupleOcc_maybe occ      -- unboxed from the other
   =    -- Special case for tuples; there are too many
        -- of them to pre-populate the original-name cache
@@ -214,7 +212,8 @@ lookupOrigNameCache nc mod occ      -- The normal case
 
 extendOrigNameCache :: OrigNameCache -> Name -> OrigNameCache
 extendOrigNameCache nc name 
-  = extendNameCache nc (nameModule name) (nameOccName name) name
+  = ASSERT2( isExternalName name, ppr name ) 
+    extendNameCache nc (nameModule name) (nameOccName name) name
 
 extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache
 extendNameCache nc mod occ name