diff options
author | Edward Z. Yang <ezyang@fb.com> | 2018-02-06 13:27:46 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-02-06 14:21:16 -0500 |
commit | 4c364402ad9edade698863a3684f395e737b9de2 (patch) | |
tree | d77c3bc6d4c837355f66836aa2a491709ad5cf52 /compiler/main/Packages.hs | |
parent | 4d1c3b72ec27c8e51fb40809bba3ce35246a2966 (diff) | |
download | haskell-4c364402ad9edade698863a3684f395e737b9de2.tar.gz |
Restore 'It is a member of hidden package' message.
See comment in Packages for more details.
Fixes #14717.
Signed-off-by: Edward 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
Diffstat (limited to 'compiler/main/Packages.hs')
-rw-r--r-- | compiler/main/Packages.hs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 14407be418..e8e9032761 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -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 |