[project @ 2000-11-28 11:37:14 by sewardj]
authorsewardj <unknown>
Tue, 28 Nov 2000 11:37:14 +0000 (11:37 +0000)
committersewardj <unknown>
Tue, 28 Nov 2000 11:37:14 +0000 (11:37 +0000)
Don't try and read your own interface from disk in interactive mode.

ghc/compiler/main/HscMain.lhs
ghc/compiler/rename/Rename.lhs
ghc/compiler/rename/RnHiFiles.lhs

index a0eacf3..603c993 100644 (file)
@@ -118,7 +118,7 @@ hscMain ghci_mode dflags source_unchanged location maybe_old_iface hst hit pcs
                        ++ ", hspp = " ++ show (ml_hspp_file location));
 
       (pcs_ch, errs_found, (recomp_reqd, maybe_checked_iface))
-         <- checkOldIface dflags hit hst pcs 
+         <- checkOldIface ghci_mode dflags hit hst pcs 
                (unJust "hscMain" (ml_hi_file location))
                source_unchanged maybe_old_iface;
 
index be45b05..aca2451 100644 (file)
@@ -74,6 +74,7 @@ import HscTypes               ( PersistentCompilerState, HomeIfaceTable, HomeSymbolTable,
                          Provenance(..), ImportReason(..), initialVersionInfo,
                          Deprecations(..), lookupDeprec, lookupIface
                         )
+import CmStaticInfo    ( GhciMode(..) )
 import List            ( partition, nub )
 \end{code}
 
@@ -452,7 +453,8 @@ rnDeprecs gbl_env Nothing decls
 %************************************************************************
 
 \begin{code}
-checkOldIface :: DynFlags
+checkOldIface :: GhciMode
+              -> DynFlags
              -> HomeIfaceTable -> HomeSymbolTable
              -> PersistentCompilerState
              -> FilePath
@@ -461,7 +463,14 @@ checkOldIface :: DynFlags
              -> IO (PersistentCompilerState, Bool, (RecompileRequired, Maybe ModIface))
                                -- True <=> errors happened
 
-checkOldIface dflags hit hst pcs iface_path source_unchanged maybe_iface
+checkOldIface ghci_mode dflags hit hst pcs iface_path source_unchanged maybe_iface
+
+  -- If the source has changed and we're in interactive mode, avoid reading
+  -- an interface; just return the one we might have been supplied with.
+  | ghci_mode == Interactive && not source_unchanged
+  = return (pcs, False, (outOfDate, maybe_iface))
+
+  | otherwise
   = runRn dflags hit hst pcs (panic "Bogus module") $
     case maybe_iface of
        Just old_iface -> -- Use the one we already have
index 42240c1..2020749 100644 (file)
@@ -501,7 +501,8 @@ readIface :: String -> RnM d (Either Message ParsedIface)
        -- Nothing <=> file not found, or unreadable, or illegible
        -- Just x  <=> successfully found and parsed 
 readIface file_path
-  = traceRn (ptext SLIT("readIFace") <+> text file_path)       `thenRn_` 
+  = --ioToRnM (putStrLn ("reading iface " ++ file_path)) `thenRn_`
+    traceRn (ptext SLIT("readIFace") <+> text file_path)       `thenRn_` 
 
     ioToRnM (hGetStringBuffer False file_path)                 `thenRn` \ read_result ->
     case read_result of {