projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Require a bang pattern when unlifted types are where/let bound; #3182
[ghc-hetmet.git]
/
compiler
/
main
/
DriverMkDepend.hs
diff --git
a/compiler/main/DriverMkDepend.hs
b/compiler/main/DriverMkDepend.hs
index
5b63392
..
7451cef
100644
(file)
--- a/
compiler/main/DriverMkDepend.hs
+++ b/
compiler/main/DriverMkDepend.hs
@@
-17,15
+17,16
@@
module DriverMkDepend (
import qualified GHC
import GHC ( ModSummary(..), GhcMonad )
import qualified GHC
import GHC ( ModSummary(..), GhcMonad )
+import HsSyn ( ImportDecl(..) )
import PrelNames
import DynFlags
import Util
import PrelNames
import DynFlags
import Util
-import HscTypes ( HscEnv, IsBootInterface, msObjFilePath, msHsFilePath, getSession )
+import HscTypes
import SysTools ( newTempName )
import qualified SysTools
import Module
import Digraph ( SCC(..) )
import SysTools ( newTempName )
import qualified SysTools
import Module
import Digraph ( SCC(..) )
-import Finder ( findImportedModule, FindResult(..) )
+import Finder
import Outputable
import Panic
import SrcLoc
import Outputable
import Panic
import SrcLoc
@@
-33,7
+34,7
@@
import Data.List
import FastString
import Exception
import FastString
import Exception
-import ErrUtils ( debugTraceMsg, putMsg )
+import ErrUtils
import MonadUtils ( liftIO )
import System.Directory
import MonadUtils ( liftIO )
import System.Directory
@@
-186,8
+187,8
@@
processDeps dflags hsc_env excl_mods hdl (AcyclicSCC node)
obj_file = msObjFilePath node
obj_files = insertSuffixes obj_file extra_suffixes
obj_file = msObjFilePath node
obj_files = insertSuffixes obj_file extra_suffixes
- do_imp is_boot imp_mod
- = do { mb_hi <- findDependency hsc_env src_file imp_mod
+ do_imp loc is_boot pkg_qual imp_mod
+ = do { mb_hi <- findDependency hsc_env loc pkg_qual imp_mod
is_boot include_pkg_deps
; case mb_hi of {
Nothing -> return () ;
is_boot include_pkg_deps
; case mb_hi of {
Nothing -> return () ;
@@
-207,29
+208,31
@@
processDeps dflags hsc_env excl_mods hdl (AcyclicSCC node)
-- Emit a dependency for each import
-- Emit a dependency for each import
- -- SOURCE imports
- ; mapM_ (do_imp True)
- (filter (`notElem` excl_mods) (map unLoc (ms_srcimps node)))
+ ; let do_imps is_boot idecls = sequence_
+ [ do_imp loc is_boot (ideclPkgQual i) mod
+ | L loc i <- idecls,
+ let mod = unLoc (ideclName i),
+ mod `notElem` excl_mods ]
- -- regular imports
- ; mapM_ (do_imp False)
- (filter (`notElem` excl_mods) (map unLoc (ms_imps node)))
+ ; do_imps True (ms_srcimps node)
+ ; do_imps False (ms_imps node)
; when (dopt Opt_ImplicitPrelude (ms_hspp_opts node)) $
; when (dopt Opt_ImplicitPrelude (ms_hspp_opts node)) $
- do_imp False pRELUDE_NAME
+ do_imp noSrcSpan False Nothing pRELUDE_NAME
}
findDependency :: HscEnv
}
findDependency :: HscEnv
- -> FilePath -- Importing module: used only for error msg
+ -> SrcSpan
+ -> Maybe FastString -- package qualifier, if any
-> ModuleName -- Imported module
-> IsBootInterface -- Source import
-> Bool -- Record dependency on package modules
-> IO (Maybe FilePath) -- Interface file file
-> ModuleName -- Imported module
-> IsBootInterface -- Source import
-> Bool -- Record dependency on package modules
-> IO (Maybe FilePath) -- Interface file file
-findDependency hsc_env _ imp is_boot include_pkg_deps
+findDependency hsc_env srcloc pkg imp is_boot include_pkg_deps
= do { -- Find the module; this will be fast because
-- we've done it once during downsweep
= do { -- Find the module; this will be fast because
-- we've done it once during downsweep
- r <- findImportedModule hsc_env imp Nothing
+ r <- findImportedModule hsc_env imp pkg
; case r of
Found loc _
-- Home package: just depend on the .hi or hi-boot file
; case r of
Found loc _
-- Home package: just depend on the .hi or hi-boot file
@@
-240,7
+243,8
@@
findDependency hsc_env _ imp is_boot include_pkg_deps
| otherwise
-> return Nothing
| otherwise
-> return Nothing
- _ -> panic "findDependency"
+ fail -> throwOneError $ mkPlainErrMsg srcloc $
+ cannotFindModule (hsc_dflags hsc_env) imp fail
}
-----------------------------
}
-----------------------------
@@
-359,7
+363,7
@@
pprCycle summaries = pp_group (CyclicSCC summaries)
pp_ms loop_breaker $$ vcat (map pp_group groups)
where
(boot_only, others) = partition is_boot_only mss
pp_ms loop_breaker $$ vcat (map pp_group groups)
where
(boot_only, others) = partition is_boot_only mss
- is_boot_only ms = not (any in_group (ms_imps ms))
+ is_boot_only ms = not (any in_group (map (ideclName.unLoc) (ms_imps ms)))
in_group (L _ m) = m `elem` group_mods
group_mods = map (moduleName . ms_mod) mss
in_group (L _ m) = m `elem` group_mods
group_mods = map (moduleName . ms_mod) mss
@@
-368,8
+372,8
@@
pprCycle summaries = pp_group (CyclicSCC summaries)
groups = GHC.topSortModuleGraph True all_others Nothing
pp_ms summary = text mod_str <> text (take (20 - length mod_str) (repeat ' '))
groups = GHC.topSortModuleGraph True all_others Nothing
pp_ms summary = text mod_str <> text (take (20 - length mod_str) (repeat ' '))
- <+> (pp_imps empty (ms_imps summary) $$
- pp_imps (ptext (sLit "{-# SOURCE #-}")) (ms_srcimps summary))
+ <+> (pp_imps empty (map (ideclName.unLoc) (ms_imps summary)) $$
+ pp_imps (ptext (sLit "{-# SOURCE #-}")) (map (ideclName.unLoc) (ms_srcimps summary)))
where
mod_str = moduleNameString (moduleName (ms_mod summary))
where
mod_str = moduleNameString (moduleName (ms_mod summary))