summaryrefslogtreecommitdiff
path: root/compiler/main/Finder.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main/Finder.hs')
-rw-r--r--compiler/main/Finder.hs46
1 files changed, 23 insertions, 23 deletions
diff --git a/compiler/main/Finder.hs b/compiler/main/Finder.hs
index 208475fefb..1ccf33f668 100644
--- a/compiler/main/Finder.hs
+++ b/compiler/main/Finder.hs
@@ -72,7 +72,7 @@ flushFinderCaches hsc_env =
where
this_pkg = thisPackage (hsc_dflags hsc_env)
fc_ref = hsc_FC hsc_env
- is_ext mod _ | modulePackageKey mod /= this_pkg = True
+ is_ext mod _ | moduleUnitId mod /= this_pkg = True
| otherwise = False
addToFinderCache :: IORef FinderCache -> Module -> FindResult -> IO ()
@@ -121,7 +121,7 @@ findImportedModule hsc_env mod_name mb_pkg =
findExactModule :: HscEnv -> Module -> IO FindResult
findExactModule hsc_env mod =
let dflags = hsc_dflags hsc_env
- in if modulePackageKey mod == thisPackage dflags
+ in if moduleUnitId mod == thisPackage dflags
then findHomeModule hsc_env (moduleName mod)
else findPackageModule hsc_env mod
@@ -167,8 +167,8 @@ findExposedPackageModule hsc_env mod_name mb_pkg
return (FoundMultiple rs)
LookupHidden pkg_hiddens mod_hiddens ->
return (NotFound{ fr_paths = [], fr_pkg = Nothing
- , fr_pkgs_hidden = map (modulePackageKey.fst) pkg_hiddens
- , fr_mods_hidden = map (modulePackageKey.fst) mod_hiddens
+ , fr_pkgs_hidden = map (moduleUnitId.fst) pkg_hiddens
+ , fr_mods_hidden = map (moduleUnitId.fst) mod_hiddens
, fr_suggestions = [] })
LookupNotFound suggest ->
return (NotFound{ fr_paths = [], fr_pkg = Nothing
@@ -211,7 +211,7 @@ uncacheModule hsc_env mod = do
-- 2. When you have a package qualified import with package name "this",
-- we shortcut to the home module.
--
--- 3. When we look up an exact 'Module', if the package key associated with
+-- 3. When we look up an exact 'Module', if the unit id associated with
-- the module is the current home module do a look up in the home module.
--
-- 4. Some special-case code in GHCi (ToDo: Figure out why that needs to
@@ -258,7 +258,7 @@ findPackageModule :: HscEnv -> Module -> IO FindResult
findPackageModule hsc_env mod = do
let
dflags = hsc_dflags hsc_env
- pkg_id = modulePackageKey mod
+ pkg_id = moduleUnitId mod
--
case lookupPackage dflags pkg_id of
Nothing -> return (NoPackage pkg_id)
@@ -268,12 +268,12 @@ findPackageModule hsc_env mod = do
-- requires a few invariants to be upheld: (1) the 'Module' in question must
-- be the module identifier of the *original* implementation of a module,
-- not a reexport (this invariant is upheld by @Packages.hs@) and (2)
--- the 'PackageConfig' must be consistent with the package key in the 'Module'.
+-- the 'PackageConfig' must be consistent with the unit id in the 'Module'.
-- The redundancy is to avoid an extra lookup in the package state
-- for the appropriate config.
findPackageModule_ :: HscEnv -> Module -> PackageConfig -> IO FindResult
findPackageModule_ hsc_env mod pkg_conf =
- ASSERT( modulePackageKey mod == packageConfigId pkg_conf )
+ ASSERT( moduleUnitId mod == packageConfigId pkg_conf )
modLocationCache hsc_env mod $
-- special case for GHC.Prim; we won't find it in the filesystem.
@@ -343,7 +343,7 @@ searchPathExts paths mod exts
]
search [] = return (NotFound { fr_paths = map fst to_search
- , fr_pkg = Just (modulePackageKey mod)
+ , fr_pkg = Just (moduleUnitId mod)
, fr_mods_hidden = [], fr_pkgs_hidden = []
, fr_suggestions = [] })
@@ -531,7 +531,7 @@ cantFindErr _ multiple_found _ mod_name (FoundMultiple mods)
where
unambiguousPackages = foldl' unambiguousPackage (Just []) mods
unambiguousPackage (Just xs) (m, ModOrigin (Just _) _ _ _)
- = Just (modulePackageKey m : xs)
+ = Just (moduleUnitId m : xs)
unambiguousPackage _ _ = Nothing
pprMod (m, o) = ptext (sLit "it is bound as") <+> ppr m <+>
@@ -539,7 +539,7 @@ cantFindErr _ multiple_found _ mod_name (FoundMultiple mods)
pprOrigin _ ModHidden = panic "cantFindErr: bound by mod hidden"
pprOrigin m (ModOrigin e res _ f) = sep $ punctuate comma (
if e == Just True
- then [ptext (sLit "package") <+> ppr (modulePackageKey m)]
+ then [ptext (sLit "package") <+> ppr (moduleUnitId m)]
else [] ++
map ((ptext (sLit "a reexport in package") <+>)
.ppr.packageConfigId) res ++
@@ -553,7 +553,7 @@ cantFindErr cannot_find _ dflags mod_name find_result
more_info
= case find_result of
NoPackage pkg
- -> ptext (sLit "no package key matching") <+> quotes (ppr pkg) <+>
+ -> ptext (sLit "no unit id matching") <+> quotes (ppr pkg) <+>
ptext (sLit "was found") $$ looks_like_srcpkgid pkg
NotFound { fr_paths = files, fr_pkg = mb_pkg
@@ -600,11 +600,11 @@ cantFindErr cannot_find _ dflags mod_name find_result
| otherwise =
hang (ptext (sLit "Locations searched:")) 2 $ vcat (map text files)
- pkg_hidden :: PackageKey -> SDoc
+ pkg_hidden :: UnitId -> SDoc
pkg_hidden pkgid =
ptext (sLit "It is a member of the hidden package")
<+> quotes (ppr pkgid)
- --FIXME: we don't really want to show the package key here we should
+ --FIXME: we don't really want to show the unit id here we should
-- show the source package id or installed package id if it's ambiguous
<> dot $$ cabal_pkg_hidden_hint pkgid
cabal_pkg_hidden_hint pkgid
@@ -615,13 +615,13 @@ cantFindErr cannot_find _ dflags mod_name find_result
ptext (sLit "to the build-depends in your .cabal file.")
| otherwise = Outputable.empty
- looks_like_srcpkgid :: PackageKey -> SDoc
+ looks_like_srcpkgid :: UnitId -> SDoc
looks_like_srcpkgid pk
- -- Unsafely coerce a package key FastString into a source package ID
+ -- Unsafely coerce a unit id FastString into a source package ID
-- FastString and see if it means anything.
- | (pkg:pkgs) <- searchPackageId dflags (SourcePackageId (packageKeyFS pk))
- = parens (text "This package key looks like the source package ID;" $$
- text "the real package key is" <+> quotes (ftext (packageKeyFS (packageKey pkg))) $$
+ | (pkg:pkgs) <- searchPackageId dflags (SourcePackageId (unitIdFS pk))
+ = parens (text "This unit ID looks like the source package ID;" $$
+ text "the real unit ID is" <+> quotes (ftext (unitIdFS (unitId pkg))) $$
(if null pkgs then Outputable.empty
else text "and" <+> int (length pkgs) <+> text "other candidates"))
-- Todo: also check if it looks like a package name!
@@ -645,9 +645,9 @@ cantFindErr cannot_find _ dflags mod_name find_result
fromExposedReexport = res,
fromPackageFlag = f })
| Just True <- e
- = parens (ptext (sLit "from") <+> ppr (modulePackageKey mod))
+ = parens (ptext (sLit "from") <+> ppr (moduleUnitId mod))
| f && moduleName mod == m
- = parens (ptext (sLit "from") <+> ppr (modulePackageKey mod))
+ = parens (ptext (sLit "from") <+> ppr (moduleUnitId mod))
| (pkg:_) <- res
= parens (ptext (sLit "from") <+> ppr (packageConfigId pkg)
<> comma <+> ptext (sLit "reexporting") <+> ppr mod)
@@ -661,8 +661,8 @@ cantFindErr cannot_find _ dflags mod_name find_result
fromHiddenReexport = rhs })
| Just False <- e
= parens (ptext (sLit "needs flag -package-key")
- <+> ppr (modulePackageKey mod))
+ <+> ppr (moduleUnitId mod))
| (pkg:_) <- rhs
- = parens (ptext (sLit "needs flag -package-key")
+ = parens (ptext (sLit "needs flag -package-id")
<+> ppr (packageConfigId pkg))
| otherwise = Outputable.empty