diff options
author | Michael Peyton Jones <me@michaelpj.com> | 2019-03-13 11:46:56 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-03-29 14:18:14 -0400 |
commit | 8a20bfc21da6a47087c8069f92691629eb47951d (patch) | |
tree | 1427b9cf1dea767129fa545a97e87b987eb74e16 /.circleci | |
parent | 97ad5cfb1c41d19cc56f7450c1e42d988dc9fd2d (diff) | |
download | haskell-8a20bfc21da6a47087c8069f92691629eb47951d.tar.gz |
Visibility: handle multiple units with the same name
Fixes #16228. The included test case is adapted from the reproduction in
the issue, and fails without this patch.
------
We compute an initial visilibity mapping for units based on what is
present in the package databases. To seed this, we compute a set of all
the package configs to add visibilities for.
However, this set was keyed off the unit's *package name*. This is
correct, since we compare packages across databases by version. However,
we would only ever consider a single, most-preferable unit from the
database in which it was found.
The effect of this was that only one of the libraries in a Cabal package
would be added to this initial set. This would cause attempts to use
modules from the omitted libraries to fail, claiming that the package
was hidden (even though `ghc-pkg` would correctly show it as visible).
A solution is to do the selection of the most preferable packages
separately, and then be sure to consider exposing all units in the
same package in the same package db. We can do this by picking a
most-preferable unit for each package name, and then considering
exposing all units that are equi-preferable with that unit.
------
Why wasn't this bug apparent to all people trying to use sub-libraries
in Cabal? The answer is that Cabal explicitly passes `-package` and
`-package-id` flags for all the packages it wants to use, rather than
relying on the state of the package database. So this bug only really
affects people who are trying to use package databases produced by Cabal
outside of Cabal itself.
One particular example of this is the way that the
Nixpkgs Haskell infrastructure provides wrapped GHCs: typically these
are equipped with a package database containing all the needed
package dependencies, and the user is not expected to pass
`-package` flags explicitly.
Diffstat (limited to '.circleci')
0 files changed, 0 insertions, 0 deletions