diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-08-01 18:03:20 +0100 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-08-05 03:13:27 -0700 |
commit | 00b8f8c5b378fc679639ebe81238cf42d92aa607 (patch) | |
tree | 5679db0a3cfcb74bde35c2c9a01cc56a5774c6e5 /testsuite/tests/cabal/cabal05 | |
parent | de3f0644b8ff1748335c0fe07404dd4502a624e0 (diff) | |
download | haskell-00b8f8c5b378fc679639ebe81238cf42d92aa607.tar.gz |
Refactor package state, also fixing a module reexport bug.
Instead of building a multiply indirected data structure and querying
it on every import, we now have two data structures moduleToPkgConf
and moduleToPkgConfAll. moduleToPkgConf is a single-level UniqFM that
is intended to be used for most valid imports; however, it does not
contain any information useful for error reporting. If an error is
occurred, we then query moduleToPkgConfAll, which contains a more
comprehensive view of the package database. This field is lazily
initialized (so this means we're retaining the package database list,
but this should be fine because we're already maintaining the entries
of the list.) Additionally, the full view doesn't keep track of a boolean
toggle for visibility/exposure anymore, but instead tracks the *provenance*
of how the module binding came to be (the ModuleOrigin data type).
Additionally, we move the logic for determining if a module is exposed
or not from Finder.lhs and put it in Packages.lhs; this information is
communicated via the LookupResult data type. Unfortunately, we can't
directly return a FindResult, because this data type is defined in
HscTypes which depends on Packages. This is going to change some more
in the near future when I add thinning/renaming to package flags; the
error messages will need to be more flexible.
I've also slightly changed the semantics of error messages for package
qualified imports. Previously, if we didn't find any package qualified
imports, but there were hidden modules in a *different* package, the error
message would prefer mentioning those as opposed to providing suggestions.
Now, if a module is hidden but in the wrong package, we won't mention it;
instead, it will get mentioned with the other module suggestions. I
was too lazy to write a test, but I can add one if people would like.
The module reexport bug was, package q reexported p:P as Conflict,
and package r reexported p:P2 as Conflict, this was *not* reported as
a conflict, because the old logic incorrectly decided that P and P2 were
the same module on account of being from the same package. The logic here
has been corrected.
Contains haddock submodule update.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'testsuite/tests/cabal/cabal05')
-rw-r--r-- | testsuite/tests/cabal/cabal05/Makefile | 5 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal05/q/q.cabal | 3 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal05/r/r.cabal | 5 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal05/t/LICENSE | 0 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal05/t/Setup.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal05/t/T.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/cabal/cabal05/t/t.cabal | 11 |
7 files changed, 25 insertions, 4 deletions
diff --git a/testsuite/tests/cabal/cabal05/Makefile b/testsuite/tests/cabal/cabal05/Makefile index d4bc1c733a..d1ade74113 100644 --- a/testsuite/tests/cabal/cabal05/Makefile +++ b/testsuite/tests/cabal/cabal05/Makefile @@ -58,6 +58,9 @@ cabal05: clean cd s && $(SETUP) clean cd s && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d cd s && $(SETUP) build + cd t && $(SETUP) clean + cd t && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d + ! (cd t && $(SETUP) build) ifneq "$(CLEANUP)" "" $(MAKE) clean endif @@ -66,4 +69,4 @@ clean : '$(GHC_PKG)' unregister --force p >/dev/null 2>&1 || true '$(GHC_PKG)' unregister --force q >/dev/null 2>&1 || true '$(GHC_PKG)' unregister --force r >/dev/null 2>&1 || true - $(RM) -r p-* q-* r-* tmp.d *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext) + $(RM) -r p-* q-* r-* s-* t-* tmp.d *.o *.hi */*.o */*.hi */Setup$(exeext) */dist Setup$(exeext) diff --git a/testsuite/tests/cabal/cabal05/q/q.cabal b/testsuite/tests/cabal/cabal05/q/q.cabal index 2ea54f2e8d..338acdd382 100644 --- a/testsuite/tests/cabal/cabal05/q/q.cabal +++ b/testsuite/tests/cabal/cabal05/q/q.cabal @@ -25,5 +25,6 @@ library -- qualified=NO, where=SELF, renaming=YES, conflict=NO Q as QQ, -- qualified=NO, where=SELF, renaming=YES, conflict=YES (r) - Q as QMerge + Q as QMerge, + P2 as Conflict build-depends: base, p diff --git a/testsuite/tests/cabal/cabal05/r/r.cabal b/testsuite/tests/cabal/cabal05/r/r.cabal index d550340c0e..b2d4ab0939 100644 --- a/testsuite/tests/cabal/cabal05/r/r.cabal +++ b/testsuite/tests/cabal/cabal05/r/r.cabal @@ -14,7 +14,7 @@ library -- qualified=NO, where=DEP(BOTH), renaming=YES, conflict=NO P as RP2, -- qualified=NO, where=DEP(BOTH), renaming=YES, conflict=YES - P2 as PMerge, + P as PMerge, -- qualified=YES, where=DEP(ORIG), renaming=YES, conflict=NO p:P as RP, -- qualified=YES, where=DEP(REEX), renaming=YES, conflict=NO @@ -28,5 +28,6 @@ library -- qualified=YES, where=DEP, renaming=NO, conflict=YES (q) q:Q, -- qualified=YES, where=DEP(ORIG), renaming=YES, conflict=YES (q) - p:P2 as PMerge2 + p:P2 as PMerge2, + P as Conflict build-depends: base, p, q diff --git a/testsuite/tests/cabal/cabal05/t/LICENSE b/testsuite/tests/cabal/cabal05/t/LICENSE new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuite/tests/cabal/cabal05/t/LICENSE diff --git a/testsuite/tests/cabal/cabal05/t/Setup.hs b/testsuite/tests/cabal/cabal05/t/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/testsuite/tests/cabal/cabal05/t/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/testsuite/tests/cabal/cabal05/t/T.hs b/testsuite/tests/cabal/cabal05/t/T.hs new file mode 100644 index 0000000000..fcc3fb0479 --- /dev/null +++ b/testsuite/tests/cabal/cabal05/t/T.hs @@ -0,0 +1,3 @@ +module T where + +import Conflict -- should be ambiguous diff --git a/testsuite/tests/cabal/cabal05/t/t.cabal b/testsuite/tests/cabal/cabal05/t/t.cabal new file mode 100644 index 0000000000..10117d6da6 --- /dev/null +++ b/testsuite/tests/cabal/cabal05/t/t.cabal @@ -0,0 +1,11 @@ +name: t +version: 0.1.0.0 +license-file: LICENSE +author: Edward Z. Yang +maintainer: ezyang@cs.stanford.edu +build-type: Simple +cabal-version: >=1.21 + +library + exposed-modules: T + build-depends: base, q, r |