Commit 4c364402 authored by Edward Z. Yang's avatar Edward Z. Yang Committed by Ben Gamari

Restore 'It is a member of hidden package' message.

See comment in Packages for more details.

Fixes #14717.
Signed-off-by: default avatarEdward Z. Yang <ezyang@fb.com>

Test Plan: validate

Reviewers: snoyberg, taylorfausak, bgamari

Reviewed By: snoyberg, taylorfausak, bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14717

Differential Revision: https://phabricator.haskell.org/D4376
parent 4d1c3b72
......@@ -1596,8 +1596,35 @@ mkModuleToPkgConfAll
-> VisibilityMap
-> ModuleToPkgConfAll
mkModuleToPkgConfAll dflags pkg_db vis_map =
Map.foldlWithKey extend_modmap emptyMap vis_map
-- What should we fold on? Both situations are awkward:
--
-- * Folding on the visibility map means that we won't create
-- entries for packages that aren't mentioned in vis_map
-- (e.g., hidden packages, causing #14717)
--
-- * Folding on pkg_db is awkward because if we have an
-- Backpack instantiation, we need to possibly add a
-- package from pkg_db multiple times to the actual
-- ModuleToPkgConfAll. Also, we don't really want
-- definite package instantiations to show up in the
-- list of possibilities.
--
-- So what will we do instead? We'll extend vis_map with
-- entries for every definite (for non-Backpack) and
-- indefinite (for Backpack) package, so that we get the
-- hidden entries we need.
Map.foldlWithKey extend_modmap emptyMap vis_map_extended
where
vis_map_extended = Map.union vis_map {- preferred -} default_vis
default_vis = Map.fromList
[ (packageConfigId pkg, mempty)
| pkg <- eltsUDFM (unPackageConfigMap pkg_db)
-- Exclude specific instantiations of an indefinite
-- package
, indefinite pkg || null (instantiatedWith pkg)
]
emptyMap = Map.empty
sing pk m _ = Map.singleton (mkModule pk m)
addListTo = foldl' merge
......
package07e.hs:2:1: error:
Could not find module ‘MyHsTypes’
Perhaps you meant HsTypes (needs flag -package-key ghc-8.5)
Use -v to see a list of the files searched for.
package07e.hs:3:1: error:
Could not find module ‘HsTypes’
It is a member of the hidden package ‘ghc-8.5’.
Use -v to see a list of the files searched for.
package07e.hs:4:1: error:
Could not find module ‘HsUtils’
It is a member of the hidden package ‘ghc-8.5’.
Use -v to see a list of the files searched for.
package07e.hs:5:1: error:
Could not find module ‘UniqFM’
It is a member of the hidden package ‘ghc-8.5’.
Use -v to see a list of the files searched for.
package08e.hs:2:1: error:
Could not find module ‘MyHsTypes’
Perhaps you meant HsTypes (needs flag -package-key ghc-8.5)
Use -v to see a list of the files searched for.
package08e.hs:3:1: error:
Could not find module ‘HsTypes’
It is a member of the hidden package ‘ghc-8.5’.
Use -v to see a list of the files searched for.
package08e.hs:4:1: error:
Could not find module ‘HsUtils’
It is a member of the hidden package ‘ghc-8.5’.
Use -v to see a list of the files searched for.
package08e.hs:5:1: error:
Could not find module ‘UniqFM’
It is a member of the hidden package ‘ghc-8.5’.
Use -v to see a list of the files searched for.
<command line>: Could not find module ‘RuleDefiningPlugin’
Perhaps you meant
RuleDefiningPlugin (from rule-defining-plugin-0.1)
It is a member of the hidden package ‘rule-defining-plugin-0.1’.
Use -v to see a list of the files searched for.
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