summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/main/GhcMake.hs2
-rw-r--r--compiler/main/HscTypes.hs5
2 files changed, 6 insertions, 1 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index b55a4e3760..3e62558e78 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -1978,7 +1978,7 @@ downsweep hsc_env old_summaries excl_mods allow_dup_roots
getRootSummary :: Target -> IO (Either ErrMsg ModSummary)
getRootSummary (Target (TargetFile file mb_phase) obj_allowed maybe_buf)
= do exists <- liftIO $ doesFileExist file
- if exists
+ if exists || isJust maybe_buf
then Right `fmap` summariseFile hsc_env old_summaries file mb_phase
obj_allowed maybe_buf
else return $ Left $ mkPlainErrMsg dflags noSrcSpan $
diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs
index 744841a63d..e75b2457f0 100644
--- a/compiler/main/HscTypes.hs
+++ b/compiler/main/HscTypes.hs
@@ -517,6 +517,11 @@ data Target
--
-- Since GHC version 8.10 modules which require preprocessors such as
-- Literate Haskell or CPP to run are also supported.
+ --
+ -- If a corresponding source file does not exist on disk this will
+ -- result in a 'SourceError' exception if @targetId = TargetModule _@
+ -- is used. However together with @targetId = TargetFile _@ GHC will
+ -- not complain about the file missing.
}
data TargetId