[commit: ghc] ghc-8.0: Fix bug where reexports of wired-in packages don't work. (98df0e3)
git at git.haskell.org
git at git.haskell.org
Thu Feb 18 17:08:55 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/98df0e3ac4f37d3bff65d82d0c3405458e52797b/ghc
>---------------------------------------------------------------
commit 98df0e3ac4f37d3bff65d82d0c3405458e52797b
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date: Thu Feb 18 13:53:36 2016 +0100
Fix bug where reexports of wired-in packages don't work.
Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
Test Plan: validate
Reviewers: hvr, bgamari, austin
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1926
GHC Trac Issues: #11589
>---------------------------------------------------------------
98df0e3ac4f37d3bff65d82d0c3405458e52797b
compiler/main/Packages.hs | 8 +++++++-
testsuite/tests/cabal/cabal09/Main.hs | 2 ++
testsuite/tests/cabal/cabal09/Makefile | 21 +++++++++++++++++++++
testsuite/tests/cabal/{cabal05 => cabal09}/Setup.hs | 0
testsuite/tests/cabal/{cabal03 => cabal09}/all.T | 4 ++--
testsuite/tests/cabal/cabal09/reexport.cabal | 20 ++++++++++++++++++++
6 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index 809c579..18fc01f 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -771,8 +771,14 @@ findWiredInPackages dflags pkgs vis_map = do
| otherwise
= pkg
upd_deps pkg = pkg {
- depends = map upd_wired_in (depends pkg)
+ depends = map upd_wired_in (depends pkg),
+ exposedModules
+ = map (\(ExposedModule k v) ->
+ (ExposedModule k (fmap upd_wired_in_mod v)))
+ (exposedModules pkg)
}
+ upd_wired_in_mod (OriginalModule uid m)
+ = OriginalModule (upd_wired_in uid) m
upd_wired_in key
| Just key' <- Map.lookup key wiredInMap = key'
| otherwise = key
diff --git a/testsuite/tests/cabal/cabal09/Main.hs b/testsuite/tests/cabal/cabal09/Main.hs
new file mode 100644
index 0000000..eabafdf
--- /dev/null
+++ b/testsuite/tests/cabal/cabal09/Main.hs
@@ -0,0 +1,2 @@
+import Data.List.NonEmpty
+main = return ()
diff --git a/testsuite/tests/cabal/cabal09/Makefile b/testsuite/tests/cabal/cabal09/Makefile
new file mode 100644
index 0000000..e89c2ea
--- /dev/null
+++ b/testsuite/tests/cabal/cabal09/Makefile
@@ -0,0 +1,21 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP = ./Setup -v0
+
+# This test is for package reexports from a wired-in package,
+# which had a bug
+
+cabal09: clean
+ $(MAKE) clean
+ '$(TEST_HC)' -v0 --make Setup
+ $(SETUP) clean
+ $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)'
+ $(SETUP) build
+ifneq "$(CLEANUP)" ""
+ $(MAKE) clean
+endif
+
+clean :
+ $(RM) -r */dist Setup$(exeext) *.o *.hi
diff --git a/testsuite/tests/cabal/cabal05/Setup.hs b/testsuite/tests/cabal/cabal09/Setup.hs
similarity index 100%
copy from testsuite/tests/cabal/cabal05/Setup.hs
copy to testsuite/tests/cabal/cabal09/Setup.hs
diff --git a/testsuite/tests/cabal/cabal03/all.T b/testsuite/tests/cabal/cabal09/all.T
similarity index 61%
copy from testsuite/tests/cabal/cabal03/all.T
copy to testsuite/tests/cabal/cabal09/all.T
index 01d3882..66bdb01 100644
--- a/testsuite/tests/cabal/cabal03/all.T
+++ b/testsuite/tests/cabal/cabal09/all.T
@@ -3,7 +3,7 @@ if default_testopts.cleanup != '':
else:
cleanup = ''
-test('cabal03',
+test('cabal09',
ignore_output,
run_command,
- ['$MAKE -s --no-print-directory cabal03 ' + cleanup])
+ ['$MAKE -s --no-print-directory cabal09 ' + cleanup])
diff --git a/testsuite/tests/cabal/cabal09/reexport.cabal b/testsuite/tests/cabal/cabal09/reexport.cabal
new file mode 100644
index 0000000..447a3ee
--- /dev/null
+++ b/testsuite/tests/cabal/cabal09/reexport.cabal
@@ -0,0 +1,20 @@
+-- Initial reexport.cabal generated by cabal init. For further
+-- documentation, see http://haskell.org/cabal/users-guide/
+
+name: reexport
+version: 0.1.0.0
+license: BSD3
+author: Edward Z. Yang
+maintainer: ezyang at cs.stanford.edu
+build-type: Simple
+cabal-version: >=1.23
+
+library
+ reexported-modules: Data.List.NonEmpty
+ build-depends: base >=4.9 && <4.10
+ default-language: Haskell2010
+
+executable foo
+ main-is: Main.hs
+ build-depends: base, reexport
+ default-language: Haskell2010
More information about the ghc-commits
mailing list