From f75dd263032efa93c846aa82153cb42512392428 Mon Sep 17 00:00:00 2001 From: sewardj Date: Tue, 28 Nov 2000 11:37:14 +0000 Subject: [PATCH] [project @ 2000-11-28 11:37:14 by sewardj] Don't try and read your own interface from disk in interactive mode. --- ghc/compiler/main/HscMain.lhs | 2 +- ghc/compiler/rename/Rename.lhs | 13 +++++++++++-- ghc/compiler/rename/RnHiFiles.lhs | 3 ++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/main/HscMain.lhs b/ghc/compiler/main/HscMain.lhs index a0eacf3..603c993 100644 --- a/ghc/compiler/main/HscMain.lhs +++ b/ghc/compiler/main/HscMain.lhs @@ -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; diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs index be45b05..aca2451 100644 --- a/ghc/compiler/rename/Rename.lhs +++ b/ghc/compiler/rename/Rename.lhs @@ -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 diff --git a/ghc/compiler/rename/RnHiFiles.lhs b/ghc/compiler/rename/RnHiFiles.lhs index 42240c1..2020749 100644 --- a/ghc/compiler/rename/RnHiFiles.lhs +++ b/ghc/compiler/rename/RnHiFiles.lhs @@ -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 { -- 1.7.10.4