[commit: ghc] master: Restore 'It is a member of hidden package' message. (4c36440)
git at git.haskell.org
git at git.haskell.org
Tue Feb 6 19:22:07 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/4c364402ad9edade698863a3684f395e737b9de2/ghc
>---------------------------------------------------------------
commit 4c364402ad9edade698863a3684f395e737b9de2
Author: Edward Z. Yang <ezyang at fb.com>
Date: Tue Feb 6 13:27:46 2018 -0500
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 at 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
>---------------------------------------------------------------
4c364402ad9edade698863a3684f395e737b9de2
compiler/main/Packages.hs | 29 ++++++++++++++++++++++++++++-
testsuite/tests/package/package07e.stderr | 4 ++++
testsuite/tests/package/package08e.stderr | 4 ++++
testsuite/tests/plugins/T11244.stderr | 3 +--
4 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index 14407be..e8e9032 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
diff --git a/testsuite/tests/package/package07e.stderr b/testsuite/tests/package/package07e.stderr
index a446a47..9ca835f 100644
--- a/testsuite/tests/package/package07e.stderr
+++ b/testsuite/tests/package/package07e.stderr
@@ -1,16 +1,20 @@
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.
diff --git a/testsuite/tests/package/package08e.stderr b/testsuite/tests/package/package08e.stderr
index 3d8d232..5992a4c 100644
--- a/testsuite/tests/package/package08e.stderr
+++ b/testsuite/tests/package/package08e.stderr
@@ -1,16 +1,20 @@
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.
diff --git a/testsuite/tests/plugins/T11244.stderr b/testsuite/tests/plugins/T11244.stderr
index f489103..30c8c5b 100644
--- a/testsuite/tests/plugins/T11244.stderr
+++ b/testsuite/tests/plugins/T11244.stderr
@@ -1,4 +1,3 @@
<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.
More information about the ghc-commits
mailing list