[commit: ghc] ghc-8.0: ghci: add message when reusing compiled code #9887 (89bec2c)
git at git.haskell.org
git at git.haskell.org
Sat Mar 12 21:45:52 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/89bec2cf1b092b46481c6237ea4e1f879564b32c/ghc
>---------------------------------------------------------------
commit 89bec2cf1b092b46481c6237ea4e1f879564b32c
Author: Alexander Lukyanov <alex.dontexist at gmail.com>
Date: Sat Mar 12 12:03:47 2016 +0100
ghci: add message when reusing compiled code #9887
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1991
GHC Trac Issues: #9887
(cherry picked from commit 41051dd846c3a7fc01cbb8ad3b7dd2b4332f7f0b)
>---------------------------------------------------------------
89bec2cf1b092b46481c6237ea4e1f879564b32c
docs/users_guide/ghci.rst | 4 ++--
ghc/GHCi/UI.hs | 21 ++++++++++++++-------
testsuite/tests/ghci/scripts/ghci058.stdout | 4 ++--
3 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst
index 20afb89..a29f94c 100644
--- a/docs/users_guide/ghci.rst
+++ b/docs/users_guide/ghci.rst
@@ -232,7 +232,7 @@ We can compile ``D``, then load the whole program, like this:
Compiling B ( B.hs, interpreted )
Compiling C ( C.hs, interpreted )
Compiling A ( A.hs, interpreted )
- Ok, modules loaded: A, B, C, D.
+ Ok, modules loaded: A, B, C, D (D.o).
*Main>
In the messages from the compiler, we see that there is no line for
@@ -304,7 +304,7 @@ picked up by :ghci-cmd:`:reload`, only :ghci-cmd:`:load`:
*Main> :load A
Compiling B ( B.hs, interpreted )
Compiling A ( A.hs, interpreted )
- Ok, modules loaded: A, B, C, D.
+ Ok, modules loaded: A, B, C (C.o), D (D.o).
The automatic loading of object files can sometimes lead to confusion,
because non-exported top-level definitions of a module are only
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index cc180f2..a335aea 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -51,7 +51,7 @@ import GHC ( LoadHowMuch(..), Target(..), TargetId(..), InteractiveImport(..),
import HsImpExp
import HsSyn
import HscTypes ( tyThingParent_maybe, handleFlagWarnings, getSafeMode, hsc_IC,
- setInteractivePrintName, hsc_dflags )
+ setInteractivePrintName, hsc_dflags, msObjFilePath )
import Module
import Name
import Packages ( trusted, getPackageDetails, listVisibleModuleNames, pprFlag )
@@ -1569,10 +1569,9 @@ afterLoad :: SuccessFlag
afterLoad ok retain_context = do
lift revertCAFs -- always revert CAFs on load.
lift discardTickArrays
- loaded_mod_summaries <- getLoadedModules
- let loaded_mods = map GHC.ms_mod loaded_mod_summaries
+ loaded_mods <- getLoadedModules
modulesLoadedMsg ok loaded_mods
- lift $ setContextAfterLoad retain_context loaded_mod_summaries
+ lift $ setContextAfterLoad retain_context loaded_mods
setContextAfterLoad :: Bool -> [GHC.ModSummary] -> GHCi ()
setContextAfterLoad keep_ctxt [] = do
@@ -1646,14 +1645,22 @@ keepPackageImports = filterM is_pkg_import
mod_name = unLoc (ideclName d)
-modulesLoadedMsg :: SuccessFlag -> [Module] -> InputT GHCi ()
+modulesLoadedMsg :: SuccessFlag -> [GHC.ModSummary] -> InputT GHCi ()
modulesLoadedMsg ok mods = do
dflags <- getDynFlags
unqual <- GHC.getPrintUnqual
+ let mod_name mod = do
+ is_interpreted <- GHC.isModuleInterpreted mod
+ return $ if is_interpreted
+ then ppr (GHC.ms_mod mod)
+ else ppr (GHC.ms_mod mod)
+ <> text " ("
+ <> text (normalise $ msObjFilePath mod)
+ <> text ")" -- fix #9887
+ mod_names <- mapM mod_name mods
let mod_commas
| null mods = text "none."
- | otherwise = hsep (
- punctuate comma (map ppr mods)) <> text "."
+ | otherwise = hsep (punctuate comma mod_names) <> text "."
status = case ok of
Failed -> text "Failed"
Succeeded -> text "Ok"
diff --git a/testsuite/tests/ghci/scripts/ghci058.stdout b/testsuite/tests/ghci/scripts/ghci058.stdout
index 7347571..bc77f05 100644
--- a/testsuite/tests/ghci/scripts/ghci058.stdout
+++ b/testsuite/tests/ghci/scripts/ghci058.stdout
@@ -1,4 +1,4 @@
-Ok, modules loaded: Ghci058.
+Ok, modules loaded: Ghci058 (Ghci058.o).
'a'
-Ok, modules loaded: Ghci058.
+Ok, modules loaded: Ghci058 (Ghci058.o).
'b'
More information about the ghc-commits
mailing list