Commit 1edee7a8 authored by Lennart Spitzner's avatar Lennart Spitzner Committed by Ben Gamari
Browse files

Fix crash in isModuleInterpreted for HsBoot (fixes #13591)

Rename isModuleInterpreted to moduleIsBootOrNotObjectLinkable
because a) there already is a moduleIsInterpreted function in
the same module b) I have no idea if the (new) semantic of
the bool returned matches some understanding of
"is interpreted".
parent ab91daf2
...@@ -112,7 +112,7 @@ module GHC ( ...@@ -112,7 +112,7 @@ module GHC (
moduleIsInterpreted, moduleIsInterpreted,
getInfo, getInfo,
showModule, showModule,
isModuleInterpreted, moduleIsBootOrNotObjectLinkable,
-- ** Inspecting types and kinds -- ** Inspecting types and kinds
exprType, TcRnExprMode(..), exprType, TcRnExprMode(..),
......
...@@ -31,7 +31,7 @@ module InteractiveEval ( ...@@ -31,7 +31,7 @@ module InteractiveEval (
typeKind, typeKind,
parseName, parseName,
showModule, showModule,
isModuleInterpreted, moduleIsBootOrNotObjectLinkable,
parseExpr, compileParsedExpr, parseExpr, compileParsedExpr,
compileExpr, dynCompileExpr, compileExpr, dynCompileExpr,
compileExprRemote, compileParsedExprRemote, compileExprRemote, compileParsedExprRemote,
...@@ -901,17 +901,17 @@ dynCompileExpr expr = do ...@@ -901,17 +901,17 @@ dynCompileExpr expr = do
showModule :: GhcMonad m => ModSummary -> m String showModule :: GhcMonad m => ModSummary -> m String
showModule mod_summary = showModule mod_summary =
withSession $ \hsc_env -> do withSession $ \hsc_env -> do
interpreted <- isModuleInterpreted mod_summary interpreted <- moduleIsBootOrNotObjectLinkable mod_summary
let dflags = hsc_dflags hsc_env let dflags = hsc_dflags hsc_env
return (showModMsg dflags (hscTarget dflags) interpreted mod_summary) return (showModMsg dflags (hscTarget dflags) interpreted mod_summary)
isModuleInterpreted :: GhcMonad m => ModSummary -> m Bool moduleIsBootOrNotObjectLinkable :: GhcMonad m => ModSummary -> m Bool
isModuleInterpreted mod_summary = withSession $ \hsc_env -> moduleIsBootOrNotObjectLinkable mod_summary = withSession $ \hsc_env ->
case lookupHpt (hsc_HPT hsc_env) (ms_mod_name mod_summary) of case lookupHpt (hsc_HPT hsc_env) (ms_mod_name mod_summary) of
Nothing -> panic "missing linkable" Nothing -> panic "missing linkable"
Just mod_info -> return (not obj_linkable) Just mod_info -> return $ case hm_linkable mod_info of
where Nothing -> True
obj_linkable = isObjectLinkable (expectJust "showModule" (hm_linkable mod_info)) Just linkable -> not (isObjectLinkable linkable)
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
-- RTTI primitives -- RTTI primitives
......
...@@ -1801,7 +1801,7 @@ modulesLoadedMsg ok mods = do ...@@ -1801,7 +1801,7 @@ modulesLoadedMsg ok mods = do
dflags <- getDynFlags dflags <- getDynFlags
unqual <- GHC.getPrintUnqual unqual <- GHC.getPrintUnqual
let mod_name mod = do let mod_name mod = do
is_interpreted <- GHC.isModuleInterpreted mod is_interpreted <- GHC.moduleIsBootOrNotObjectLinkable mod
return $ if is_interpreted return $ if is_interpreted
then ppr (GHC.ms_mod mod) then ppr (GHC.ms_mod mod)
else ppr (GHC.ms_mod mod) else ppr (GHC.ms_mod mod)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment