summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit/State.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-12-22 16:59:53 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2021-12-22 17:20:12 +0000
commitb8e4102bd19d86d6a60ee78fba81c9a3b5be2aed (patch)
treee588149d0c7b2ae9070c88206402199e6f9e7dcb /compiler/GHC/Unit/State.hs
parent09b6cb45505c2c32ddaffcdb930fb3f7873b2cfc (diff)
downloadhaskell-wip/resolve-package-import.tar.gz
Properly filter for module visibility in resolvePackageImportwip/resolve-package-import
This completes the fix for #20779 / !7123. Beforehand, the program worked by accident because the two versions of the library happened to be ordered properly (due to how the hashes were computed). In the real world I observed them being the other way around which meant the final lookup failed because we weren't filtering for visibility. I modified the test so that it failed (and it's fixed by this patch).
Diffstat (limited to 'compiler/GHC/Unit/State.hs')
-rw-r--r--compiler/GHC/Unit/State.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/Unit/State.hs b/compiler/GHC/Unit/State.hs
index e178bafea6..859b99f1a1 100644
--- a/compiler/GHC/Unit/State.hs
+++ b/compiler/GHC/Unit/State.hs
@@ -551,7 +551,7 @@ searchPackageId pkgstate pid = filter ((pid ==) . unitPackageId)
resolvePackageImport :: UnitState -> ModuleName -> PackageName -> Maybe UnitId
resolvePackageImport unit_st mn pn = do
-- 1. Find all modules providing the ModuleName (this accounts for visibility/thinning etc)
- providers <- Map.lookup mn (moduleNameProvidersMap unit_st)
+ providers <- Map.filter originVisible <$> Map.lookup mn (moduleNameProvidersMap unit_st)
-- 2. Get the UnitIds of the candidates
let candidates_uid = map (toUnitId . moduleUnit) $ Map.keys providers
-- 3. Get the package names of the candidates