in stage1, we should get isPrint and isUpper from Compat.Unicode, not Data.Char
[ghc-hetmet.git] / ghc / compiler / main / HscTypes.lhs
index 48041c0..2f2888d 100644 (file)
@@ -84,6 +84,7 @@ import Type           ( TyThing(..) )
 import Class           ( Class, classSelIds, classTyCon )
 import TyCon           ( TyCon, tyConSelIds, tyConDataCons )
 import DataCon         ( dataConImplicitIds )
+import PrelNames       ( gHC_PRIM )
 import Packages                ( PackageIdH, PackageId, PackageConfig, HomeModules )
 import DynFlags                ( DynFlags(..), isOneShot )
 import DriverPhases    ( HscSource(..), isHsBoot, hscSourceString, Phase )
@@ -94,7 +95,7 @@ import IfaceSyn               ( IfaceInst, IfaceRule, IfaceDecl(ifName) )
 
 import FiniteMap       ( FiniteMap )
 import CoreSyn         ( CoreRule )
-import Maybes          ( orElse, fromJust, expectJust )
+import Maybes          ( orElse, expectJust, expectJust )
 import Outputable
 import SrcLoc          ( SrcSpan, Located )
 import UniqSupply      ( UniqSupply )
@@ -275,9 +276,17 @@ hptRules hsc_env deps
     |  -- Find each non-hi-boot module below me
       (mod, False) <- deps
 
+       -- unsavoury: when compiling the base package with --make, we
+       -- sometimes try to look up RULES for GHC.Prim.  GHC.Prim won't
+       -- be in the HPT, because we never compile it; it's in the EPT
+       -- instead.  ToDo: clean up, and remove this slightly bogus
+       -- filter:
+    , mod /= gHC_PRIM
+
        -- Look it up in the HPT
-    , let mod_info = ASSERT( mod `elemModuleEnv` hpt )
-                    fromJust (lookupModuleEnv hpt mod)
+    , let mod_info = case lookupModuleEnv hpt mod of
+                       Nothing -> pprPanic "hptRules" (ppr mod <+> ppr deps)
+                       Just x  -> x
 
        -- And get its dfuns
     , rule <- md_rules (hm_details mod_info) ]
@@ -953,9 +962,10 @@ data ModSummary
        ms_obj_date  :: Maybe ClockTime,        -- Timestamp of object, maybe
         ms_srcimps   :: [Located Module],      -- Source imports
         ms_imps      :: [Located Module],      -- Non-source imports
-        ms_hspp_file :: Maybe FilePath,                -- Filename of preprocessed source,
-                                               -- once we have preprocessed it.
-       ms_hspp_buf  :: Maybe StringBuffer      -- The actual preprocessed source, maybe.
+        ms_hspp_file :: FilePath,              -- Filename of preprocessed source.
+        ms_hspp_opts :: DynFlags,               -- Cached flags from OPTIONS, INCLUDE
+                                                -- and LANGUAGE pragmas.
+       ms_hspp_buf  :: Maybe StringBuffer      -- The actual preprocessed source, maybe.
      }
 
 -- The ModLocation contains both the original source filename and the