diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-02-11 19:20:36 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-02-11 19:20:43 -0500 |
commit | 26eaa7ecde288b9dc123f3c120e70b2cf18b4e4a (patch) | |
tree | d6e065354ec986675b637cfcf6b558b518f675cb /testsuite/tests/backpack/should_fail | |
parent | a1980ecb5626ec85fc14fbd217e2d16c7d50a120 (diff) | |
download | haskell-26eaa7ecde288b9dc123f3c120e70b2cf18b4e4a.tar.gz |
Fix #13214 by correctly setting up dep_orphs for signatures.
Prior to this, I hadn't thought about orphan handling at all.
This commit implements the semantics that if a signature
(transitively) imports an orphan instance, that instance
is considered in scope no matter what the implementing module
is. (As it turns out, this is the semantics that falls out
when orphans are recorded transitively.)
This patch fixes a few bugs:
1. Put semantic modules in dep_orphs rather than identity
modules.
2. Don't put the implementing module in dep_orphs when
merging signatures (this is a silly bug that happened
because we were reusing calculateAvails, which is
designed for imports. It mostly works for signature
merging, except this case.)
3. When renaming a signature, blast in the orphans of the
implementing module inside Dependencies.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, austin
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3095
Diffstat (limited to 'testsuite/tests/backpack/should_fail')
-rw-r--r-- | testsuite/tests/backpack/should_fail/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_fail/bkpfail43.bkp | 13 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_fail/bkpfail43.stderr | 19 |
3 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/should_fail/all.T b/testsuite/tests/backpack/should_fail/all.T index ff171d38f6..9878c79464 100644 --- a/testsuite/tests/backpack/should_fail/all.T +++ b/testsuite/tests/backpack/should_fail/all.T @@ -38,3 +38,4 @@ test('bkpfail39', expect_broken(13068), backpack_compile_fail, ['']) test('bkpfail40', normal, backpack_compile_fail, ['']) test('bkpfail41', normal, backpack_compile_fail, ['']) test('bkpfail42', normal, backpack_compile_fail, ['']) +test('bkpfail43', normal, backpack_compile_fail, ['']) diff --git a/testsuite/tests/backpack/should_fail/bkpfail43.bkp b/testsuite/tests/backpack/should_fail/bkpfail43.bkp new file mode 100644 index 0000000000..c00781d692 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail43.bkp @@ -0,0 +1,13 @@ +unit p where + signature A where + instance Show (a -> b) + module B where + import A + f = show (\x -> x) +unit q where + module A where +unit r where + dependency p[A=q:A] + module C where + import B + g = show (\x -> x) diff --git a/testsuite/tests/backpack/should_fail/bkpfail43.stderr b/testsuite/tests/backpack/should_fail/bkpfail43.stderr new file mode 100644 index 0000000000..91c010d2f7 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail43.stderr @@ -0,0 +1,19 @@ +[1 of 3] Processing p + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) + [2 of 2] Compiling B ( p/B.hs, nothing ) +[2 of 3] Processing q + Instantiating q + [1 of 1] Compiling A ( q/A.hs, bkpfail43.out/q/A.o ) +[3 of 3] Processing r + Instantiating r + [1 of 1] Including p[A=q:A] + Instantiating p[A=q:A] + [1 of 2] Compiling A[sig] ( p/A.hsig, bkpfail43.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o ) + +bkpfail43.out/p/p-HVmFlcYSefiK5n1aDP1v7x/../A.hi:1:1: error: + No instance for (GHC.Show.Show (a -> b)) + arising when attempting to show that + instance [safe] GHC.Show.Show (a -> b) + -- Defined at bkpfail43.bkp:3:18 + is provided by ‘q:A’ + (maybe you haven't applied a function to enough arguments?) |