[project @ 2003-01-08 15:47:54 by simonmar]
authorsimonmar <unknown>
Wed, 8 Jan 2003 15:47:54 +0000 (15:47 +0000)
committersimonmar <unknown>
Wed, 8 Jan 2003 15:47:54 +0000 (15:47 +0000)
Improve the missing module message in the compilation manager, too.

ghc/compiler/compMan/CompManager.lhs

index 47afe26..07c5dbe 100644 (file)
@@ -1166,11 +1166,9 @@ downsweep roots old_summaries
                        let old_summary = findModInSummaries old_summaries mod
                        summarise mod location old_summary
 
-                  Left _ -> 
-                       throwDyn (CmdLineError 
-                                   ("can't find module `" 
-                                     ++ showSDoc (ppr nm) ++ "' (while processing " 
-                                    ++ show currentMod ++ ")"))
+                  Left files -> do
+                       dflags <- getDynFlags
+                       throwDyn (noModError dflags currentMod nm files)
 
         -- loop invariant: env doesn't contain package modules
         loop :: [(FilePath,ModuleName)] -> ModuleEnv ModSummary -> IO [ModSummary]
@@ -1191,6 +1189,18 @@ downsweep roots old_summaries
                 loop new_imps (extendModuleEnvList env 
                                [ (ms_mod s, s) | s <- new_home_summaries ])
 
+-- ToDo: we don't have a proper line number for this error
+noModError dflags loc mod_nm files = ProgramError (showSDoc (
+  hang (text loc <> colon) 4 $
+    (text "Can't find module" <+> quotes (ppr mod_nm) $$ extra)
+  ))
+  where
+   extra
+    | verbosity dflags < 3 =
+        text "(use -v to see a list of the files searched for)"
+    | otherwise =
+        hang (ptext SLIT("locations searched:")) 4 (vcat (map text files))
+
 -----------------------------------------------------------------------------
 -- Summarising modules