Use MD5 checksums for recompilation checking (fixes #1372, #1959)
[ghc-hetmet.git] / compiler / main / HscMain.lhs
index 1b7df1b..9ded3f5 100644 (file)
@@ -32,15 +32,12 @@ module HscMain
     , makeSimpleDetails
     ) where
 
-#include "HsVersions.h"
-
 #ifdef GHCI
 import CodeOutput      ( outputForeignStubs )
 import ByteCodeGen     ( byteCodeGen, coreExprToBCOs )
 import Linker          ( HValue, linkExpr )
 import CoreTidy                ( tidyExpr )
 import CorePrep                ( corePrepExpr )
-import Flattening      ( flattenExpr )
 import Desugar          ( deSugarExpr )
 import SimplCore        ( simplifyExpr )
 import TcRnDriver      ( tcRnStmt, tcRnExpr, tcRnType ) 
@@ -219,7 +216,7 @@ deSugarModule hsc_env mod_summary tc_result
 makeSimpleIface :: HscEnv -> Maybe ModIface -> TcGblEnv -> ModDetails
                 -> IO (ModIface,Bool)
 makeSimpleIface hsc_env maybe_old_iface tc_result details = do
-  mkIfaceTc hsc_env maybe_old_iface details tc_result
+  mkIfaceTc hsc_env (fmap mi_iface_hash maybe_old_iface) details tc_result
 
 -- | Make a 'ModDetails' from the results of typechecking.  Used when
 -- typechecking only, as opposed to full compilation.
@@ -551,7 +548,7 @@ hscSimpleIface tc_result
        details <- mkBootModDetailsTc hsc_env tc_result
        (new_iface, no_change) 
            <- {-# SCC "MkFinalIface" #-}
-              mkIfaceTc hsc_env maybe_old_iface details tc_result
+              mkIfaceTc hsc_env (fmap mi_iface_hash maybe_old_iface) details tc_result
        -- And the answer is ...
        dumpIfaceStats hsc_env
        return (new_iface, no_change, details, tc_result)
@@ -576,9 +573,13 @@ hscNormalIface simpl_result
            -- until after code output
        (new_iface, no_change)
                <- {-# SCC "MkFinalIface" #-}
-                  mkIface hsc_env maybe_old_iface details simpl_result
+                  mkIface hsc_env (fmap mi_iface_hash maybe_old_iface)
+                         details simpl_result
        -- Emit external core
-       emitExternalCore (hsc_dflags hsc_env) (availsToNameSet (mg_exports simpl_result)) cg_guts -- Move this? --Lemmih 03/07/2006
+       -- This should definitely be here and not after CorePrep,
+       -- because CorePrep produces unqualified constructor wrapper declarations,
+       -- so its output isn't valid External Core (without some preprocessing).
+       emitExternalCore (hsc_dflags hsc_env) cg_guts 
        dumpIfaceStats hsc_env
 
            -------------------
@@ -927,7 +928,7 @@ hscParseThing parser dflags str
 
       buf <- stringToStringBuffer str
 
-      let loc  = mkSrcLoc FSLIT("<interactive>") 1 0
+      let loc  = mkSrcLoc (fsLit "<interactive>") 1 0
 
       case unP parser (mkPState buf loc dflags) of {
 
@@ -961,11 +962,8 @@ compileExpr hsc_env srcspan ds_expr
   = do { let { dflags  = hsc_dflags hsc_env ;
                lint_on = dopt Opt_DoCoreLinting dflags }
              
-               -- Flatten it
-       ; flat_expr <- flattenExpr hsc_env ds_expr
-
                -- Simplify it
-       ; simpl_expr <- simplifyExpr dflags flat_expr
+       ; simpl_expr <- simplifyExpr dflags ds_expr
 
                -- Tidy it (temporary, until coreSat does cloning)
        ; let tidy_expr = tidyExpr emptyTidyEnv simpl_expr