diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-12-22 16:59:53 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-23 10:56:11 -0500 |
commit | 80daefce4ec1169ac3ef0552b8600c71527d84c2 (patch) | |
tree | f9836356149ccbcdc91b252ee5df7e8e6e5c2f10 /testsuite | |
parent | 13a6d85a74872f22c8762d04678f7499e7890a5f (diff) | |
download | haskell-80daefce4ec1169ac3ef0552b8600c71527d84c2.tar.gz |
Properly filter for module visibility in resolvePackageImport
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 'testsuite')
6 files changed, 38 insertions, 2 deletions
diff --git a/testsuite/tests/driver/package-imports-t20779/Makefile b/testsuite/tests/driver/package-imports-t20779/Makefile index 451a1a8739..fc75a47d09 100644 --- a/testsuite/tests/driver/package-imports-t20779/Makefile +++ b/testsuite/tests/driver/package-imports-t20779/Makefile @@ -22,6 +22,13 @@ package-imports-20779: (cd q-2; $(SETUP) copy) (cd q-2; $(SETUP) register) + # build q3 + rm -rf q-3/dist + (cd q-3; $(CONFIGURE) --ipid "q-3") + (cd q-3; $(SETUP) build) + (cd q-3; $(SETUP) copy) + (cd q-3; $(SETUP) register) + # build p rm -rf p/dist (cd p; $(CONFIGURE) --ipid "p-1") diff --git a/testsuite/tests/driver/package-imports-t20779/all.T b/testsuite/tests/driver/package-imports-t20779/all.T index 2d7fb3f8ea..c6fc03d5f1 100644 --- a/testsuite/tests/driver/package-imports-t20779/all.T +++ b/testsuite/tests/driver/package-imports-t20779/all.T @@ -1,4 +1,4 @@ -test('package-imports-20779', [extra_files(['q-1', 'q-2', 'p', 'Setup.hs']), +test('package-imports-20779', [extra_files(['q-1', 'q-2', 'q-3', 'p', 'Setup.hs']), when(fast(), skip)], makefile_test, []) diff --git a/testsuite/tests/driver/package-imports-t20779/p/p.cabal b/testsuite/tests/driver/package-imports-t20779/p/p.cabal index b9d25f155c..2fdee5beaa 100644 --- a/testsuite/tests/driver/package-imports-t20779/p/p.cabal +++ b/testsuite/tests/driver/package-imports-t20779/p/p.cabal @@ -20,6 +20,6 @@ library exposed-modules: PLib -- other-modules: -- other-extensions: - build-depends: base >=4 && <5, q == 1 + build-depends: base >=4 && <5, q == 2 -- hs-source-dirs: default-language: Haskell2010 diff --git a/testsuite/tests/driver/package-imports-t20779/q-3/LICENSE b/testsuite/tests/driver/package-imports-t20779/q-3/LICENSE new file mode 100644 index 0000000000..bca70f3531 --- /dev/null +++ b/testsuite/tests/driver/package-imports-t20779/q-3/LICENSE @@ -0,0 +1 @@ +q diff --git a/testsuite/tests/driver/package-imports-t20779/q-3/QLib.hs b/testsuite/tests/driver/package-imports-t20779/q-3/QLib.hs new file mode 100644 index 0000000000..b98aa33300 --- /dev/null +++ b/testsuite/tests/driver/package-imports-t20779/q-3/QLib.hs @@ -0,0 +1,3 @@ +module QLib where + +q = 'q' diff --git a/testsuite/tests/driver/package-imports-t20779/q-3/q.cabal b/testsuite/tests/driver/package-imports-t20779/q-3/q.cabal new file mode 100644 index 0000000000..70c24cf45f --- /dev/null +++ b/testsuite/tests/driver/package-imports-t20779/q-3/q.cabal @@ -0,0 +1,25 @@ +cabal-version: >=1.10 +-- Initial package description 'q.cabal' generated by 'cabal init'. For +-- further documentation, see http://haskell.org/cabal/users-guide/ + +name: q +version: 3 +-- synopsis: +-- description: +-- bug-reports: +-- license: +license-file: LICENSE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +-- copyright: +-- category: +build-type: Simple +extra-source-files: CHANGELOG.md + +library + exposed-modules: QLib + -- other-modules: + -- other-extensions: + build-depends: base >=4 && <5 + -- hs-source-dirs: + default-language: Haskell2010 |