diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-04-30 11:09:24 -0400 |
---|---|---|
committer | Cale Gibbard <cgibbard@gmail.com> | 2020-12-28 12:28:35 -0500 |
commit | 2113a1d600e579bb0f54a0526a03626f105c0365 (patch) | |
tree | 746a62bb019f399f3921fdfb1f1f15ae521f6c90 /testsuite/tests/backpack/should_fail | |
parent | cbc7c3dda6bdf4acb760ca9eb545faeb98ab0dbe (diff) | |
download | haskell-2113a1d600e579bb0f54a0526a03626f105c0365.tar.gz |
Put hole instantiation typechecking in the module graph and fix driver batch mode backpack edges
Backpack instantiations need to be typechecked to make sure that the
arguments fit the parameters. `tcRnInstantiateSignature` checks
instantiations with concrete modules, while `tcRnCheckUnit` checks
instantiations with free holes (signatures in the current modules).
Before this change, it worked that `tcRnInstantiateSignature` was called
after typechecking the argument module, see `HscMain.hsc_typecheck`,
while `tcRnCheckUnit` was called in `unsweep'` where-bound in
`GhcMake.upsweep`. `tcRnCheckUnit` was called once per each
instantiation once all the argument sigs were processed. This was done
with simple "to do" and "already done" accumulators in the fold.
`parUpsweep` did not implement the change.
With this change, `tcRnCheckUnit` instead is associated with its own
node in the `ModuleGraph`. Nodes are now:
```haskell
data ModuleGraphNode
-- | Instantiation nodes track the instantiation of other units
-- (backpack dependencies) with the holes (signatures) of the current package.
= InstantiationNode InstantiatedUnit
-- | There is a module summary node for each module, signature, and boot module being built.
| ModuleNode ExtendedModSummary
```
instead of just `ModSummary`; the `InstantiationNode` case is the
instantiation of a unit to be checked. The dependencies of such nodes
are the same "free holes" as was checked with the accumulator before.
Both versions of upsweep on such a node call `tcRnCheckUnit`.
There previously was an `implicitRequirements` function which would
crawl through every non-current-unit module dep to look for all free
holes (signatures) to add as dependencies in `GHC.Driver.Make`. But this
is no good: we shouldn't be looking for transitive anything when
building the graph: the graph should only have immediate edges and the
scheduler takes care that all transitive requirements are met.
So `GHC.Driver.Make` stopped using `implicitRequirements`, and instead
uses a new `implicitRequirementsShallow`, which just returns the
outermost instantiation node (or module name if the immediate dependency
is itself a signature). The signature dependencies are just treated like
any other imported module, but the module ones then go in a list stored
in the `ModuleNode` next to the `ModSummary` as the "extra backpack
dependencies". When `downsweep` creates the mod summaries, it adds this
information too.
------
There is one code quality, and possible correctness thing left: In
addition to `implicitRequirements` there is `findExtraSigImports`, which
says something like "if you are an instantiation argument (you are
substituted or a signature), you need to import its things too". This
is a little non-local so I am not quite sure how to get rid of it in
`GHC.Driver.Make`, but we probably should eventually.
First though, let's try to make a test case that observes that we don't
do this, lest it actually be unneeded. Until then, I'm happy to leave it
as is.
------
Beside the ability to use `-j`, the other major user-visibile side
effect of this change is that that the --make progress log now includes
"Instantiating" messages for these new nodes. Those also are numbered
like module nodes and count towards the total.
------
Fixes #17188
Updates hackage submomdule
Metric Increase:
T12425
T13035
Diffstat (limited to 'testsuite/tests/backpack/should_fail')
32 files changed, 150 insertions, 24 deletions
diff --git a/testsuite/tests/backpack/should_fail/all.T b/testsuite/tests/backpack/should_fail/all.T index b9d1eeba3e..5e0d6fdeea 100644 --- a/testsuite/tests/backpack/should_fail/all.T +++ b/testsuite/tests/backpack/should_fail/all.T @@ -45,3 +45,7 @@ test('bkpfail46', normal, backpack_compile_fail, ['']) test('bkpfail47', normal, backpack_compile_fail, ['']) test('bkpfail48', normal, backpack_compile_fail, ['']) test('bkpfail49', normal, backpack_compile_fail, ['']) +test('bkpfail50', normal, backpack_compile_fail, ['']) +test('bkpfail51', normal, backpack_compile_fail, ['']) +test('bkpfail52', normal, backpack_compile_fail, ['']) +test('bkpfail53', normal, backpack_compile_fail, ['']) diff --git a/testsuite/tests/backpack/should_fail/bkpfail04.stderr b/testsuite/tests/backpack/should_fail/bkpfail04.stderr index 0cb8d9cfe0..397cd24851 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail04.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail04.stderr @@ -3,7 +3,7 @@ [2 of 3] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [3 of 3] Processing r - [1 of 2] Compiling A[sig] ( r/A.hsig, nothing ) + [1 of 4] Compiling A[sig] ( r/A.hsig, nothing ) bkpfail04.bkp:7:9: error: • Type constructor ‘A’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail05.stderr b/testsuite/tests/backpack/should_fail/bkpfail05.stderr index b231bbdb5b..da996cfb7e 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail05.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail05.stderr @@ -4,7 +4,8 @@ Instantiating t-impl [1 of 1] Compiling T ( t-impl/T.hs, bkpfail05.out/t-impl/T.o ) [3 of 5] Processing p - [1 of 1] Compiling H[sig] ( p/H.hsig, nothing ) + [1 of 2] Compiling H[sig] ( p/H.hsig, nothing ) + [2 of 2] Instantiating h [4 of 5] Processing h-impl Instantiating h-impl [1 of 1] Including t-impl diff --git a/testsuite/tests/backpack/should_fail/bkpfail07.stderr b/testsuite/tests/backpack/should_fail/bkpfail07.stderr index 05277035dd..251fd67f0b 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail07.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail07.stderr @@ -5,7 +5,9 @@ [2 of 3] Compiling H ( h/H.hs, nothing ) [3 of 3] Compiling A[sig] ( h/A.hsig, nothing ) [3 of 3] Processing q - [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) + [1 of 3] Compiling A[sig] ( q/A.hsig, nothing ) + [2 of 3] Instantiating h + [3 of 3] Instantiating p bkpfail07.bkp:6:9: error: • Type constructor ‘T’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail09.stderr b/testsuite/tests/backpack/should_fail/bkpfail09.stderr index b33c3b4b77..de1d100a34 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail09.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail09.stderr @@ -5,6 +5,8 @@ Instantiating q [1 of 1] Compiling H ( q/H.hs, bkpfail09.out/q/H.o ) [3 of 3] Processing r + [1 of 3] Compiling H2[sig] ( r/H2.hsig, nothing ) + [2 of 3] Instantiating p Command line argument: -unit-id p[H=H]:0:0: error: • ‘H’ is exported by the hsig file, but not exported by the implementing module ‘q:H’ diff --git a/testsuite/tests/backpack/should_fail/bkpfail12.stderr b/testsuite/tests/backpack/should_fail/bkpfail12.stderr index 0526da438c..f240d2f058 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail12.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail12.stderr @@ -5,6 +5,8 @@ Instantiating q [1 of 1] Compiling Q ( q/Q.hs, bkpfail12.out/q/Q.o ) [3 of 3] Processing r + [1 of 3] Compiling H[sig] ( r/H.hsig, nothing ) + [2 of 3] Instantiating p bkpfail12.bkp:8:9: error: • Identifier ‘f’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail13.stderr b/testsuite/tests/backpack/should_fail/bkpfail13.stderr index afd4474f35..13d227a617 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail13.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail13.stderr @@ -5,6 +5,8 @@ Instantiating q [1 of 1] Compiling QMe ( q/QMe.hs, bkpfail13.out/q/QMe.o ) [3 of 3] Processing r + [1 of 3] Compiling H[sig] ( r/H.hsig, nothing ) + [2 of 3] Instantiating p bkpfail13.bkp:8:9: error: • Identifier ‘f’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail14.stderr b/testsuite/tests/backpack/should_fail/bkpfail14.stderr index d89e6cab28..401cab2286 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail14.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail14.stderr @@ -8,6 +8,8 @@ [2 of 3] Compiling Q ( q/Q.hs, bkpfail14.out/q/Q.o ) [3 of 3] Compiling Q2 ( q/Q2.hs, bkpfail14.out/q/Q2.o ) [3 of 3] Processing r + [1 of 3] Compiling H[sig] ( r/H.hsig, nothing ) + [2 of 3] Instantiating p bkpfail14.bkp:9:9: error: • Identifier ‘f’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail15.stderr b/testsuite/tests/backpack/should_fail/bkpfail15.stderr index f32cd6dcf7..cf30efe6f8 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail15.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail15.stderr @@ -6,7 +6,8 @@ Instantiating q [1 of 1] Compiling Q ( q/Q.hs, bkpfail15.out/q/Q.o ) [3 of 3] Processing r - [1 of 1] Compiling A[sig] ( r/A.hsig, nothing ) + [1 of 2] Compiling A[sig] ( r/A.hsig, nothing ) + [2 of 2] Instantiating p bkpfail15.bkp:8:9: error: • Identifier ‘f’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail20.stderr b/testsuite/tests/backpack/should_fail/bkpfail20.stderr index 4e95695a15..bd450f9f8c 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail20.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail20.stderr @@ -3,7 +3,7 @@ [2 of 3] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [3 of 3] Processing r - [1 of 1] Compiling B[sig] ( r/B.hsig, nothing ) + [1 of 3] Compiling B[sig] ( r/B.hsig, nothing ) bkpfail20.bkp:1:1: error: • While merging export lists, could not unify Data.STRef.Lazy.newSTRef with GHC.STRef.newSTRef diff --git a/testsuite/tests/backpack/should_fail/bkpfail21.stderr b/testsuite/tests/backpack/should_fail/bkpfail21.stderr index 693135bd45..bc40bbc344 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail21.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail21.stderr @@ -5,9 +5,9 @@ [1 of 2] Compiling B[sig] ( q/B.hsig, nothing ) [2 of 2] Compiling C[sig] ( q/C.hsig, nothing ) [3 of 3] Processing r - [1 of 3] Compiling H2[sig] ( r/H2.hsig, nothing ) - [2 of 3] Compiling H1[sig] ( r/H1.hsig, nothing ) - [3 of 3] Compiling H3[sig] ( r/H3.hsig, nothing ) + [1 of 5] Compiling H2[sig] ( r/H2.hsig, nothing ) + [2 of 5] Compiling H1[sig] ( r/H1.hsig, nothing ) + [3 of 5] Compiling H3[sig] ( r/H3.hsig, nothing ) bkpfail21.bkp:1:1: error: • While merging export lists, could not unify {H1.T} with {H2.T} diff --git a/testsuite/tests/backpack/should_fail/bkpfail28.stderr b/testsuite/tests/backpack/should_fail/bkpfail28.stderr index 4428da9a41..4850e19240 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail28.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail28.stderr @@ -3,8 +3,8 @@ [2 of 3] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [3 of 3] Processing r - [1 of 2] Compiling A[sig] ( r/A.hsig, nothing ) - [2 of 2] Compiling R ( r/R.hs, nothing ) + [1 of 4] Compiling A[sig] ( r/A.hsig, nothing ) + [2 of 4] Compiling R ( r/R.hs, nothing ) bkpfail28.bkp:18:13: error: • Overlapping instances for Show (K a) arising from a use of ‘show’ diff --git a/testsuite/tests/backpack/should_fail/bkpfail29.stderr b/testsuite/tests/backpack/should_fail/bkpfail29.stderr index dde8978471..dc4f64768a 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail29.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail29.stderr @@ -3,7 +3,7 @@ [2 of 3] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [3 of 3] Processing r - [1 of 2] Compiling A[sig] ( r/A.hsig, nothing ) + [1 of 4] Compiling A[sig] ( r/A.hsig, nothing ) bkpfail29.bkp:8:9: error: • Cycle in type synonym declarations: diff --git a/testsuite/tests/backpack/should_fail/bkpfail31.stderr b/testsuite/tests/backpack/should_fail/bkpfail31.stderr index b5c9bc7b1f..ab599229ad 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail31.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail31.stderr @@ -1,7 +1,7 @@ [1 of 4] Processing p [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 4] Processing q - [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) + [1 of 3] Compiling A[sig] ( q/A.hsig, nothing ) <no location info>: error: The identifier T does not exist in the local signature. diff --git a/testsuite/tests/backpack/should_fail/bkpfail33.stderr b/testsuite/tests/backpack/should_fail/bkpfail33.stderr index 4da8897b68..addc8d9733 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail33.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail33.stderr @@ -1,7 +1,7 @@ [1 of 2] Processing p [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 2] Processing q - [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) + [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) bkpfail33.bkp:5:18: error: • Not in scope: type constructor or class ‘T’ diff --git a/testsuite/tests/backpack/should_fail/bkpfail34.stderr b/testsuite/tests/backpack/should_fail/bkpfail34.stderr index 225e491406..cbe8a1bdbe 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail34.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail34.stderr @@ -1,7 +1,7 @@ [1 of 2] Processing p [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 2] Processing q - [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) + [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) <no location info>: error: The identifier T does not exist in the local signature. diff --git a/testsuite/tests/backpack/should_fail/bkpfail35.stderr b/testsuite/tests/backpack/should_fail/bkpfail35.stderr index cbb2152f7f..893a8dd2ae 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail35.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail35.stderr @@ -2,7 +2,8 @@ [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 2] Compiling B ( p/B.hs, nothing ) [2 of 4] Processing q - [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) + [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) + [2 of 2] Instantiating p [3 of 4] Processing aimpl Instantiating aimpl [1 of 1] Compiling A ( aimpl/A.hs, bkpfail35.out/aimpl/A.o ) diff --git a/testsuite/tests/backpack/should_fail/bkpfail36.stderr b/testsuite/tests/backpack/should_fail/bkpfail36.stderr index cd65f67384..e031625aac 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail36.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail36.stderr @@ -2,8 +2,8 @@ [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 2] Compiling B[sig] ( p/B.hsig, nothing ) [2 of 2] Processing q - [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) - [2 of 2] Compiling B[sig] ( q/B.hsig, nothing ) + [1 of 3] Compiling A[sig] ( q/A.hsig, nothing ) + [2 of 3] Compiling B[sig] ( q/B.hsig, nothing ) <no location info>: error: The identifier T does not exist in the signature for <A> diff --git a/testsuite/tests/backpack/should_fail/bkpfail38.stderr b/testsuite/tests/backpack/should_fail/bkpfail38.stderr index df4a1d0483..264e150783 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail38.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail38.stderr @@ -3,7 +3,7 @@ [2 of 3] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [3 of 3] Processing r - [1 of 1] Compiling A[sig] ( r/A.hsig, nothing ) + [1 of 3] Compiling A[sig] ( r/A.hsig, nothing ) bkpfail38.bkp:8:9: error: • Identifier ‘op’ has conflicting fixities in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail41.stderr b/testsuite/tests/backpack/should_fail/bkpfail41.stderr index 6cd72dcad1..6f58345fe7 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail41.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail41.stderr @@ -5,7 +5,8 @@ Instantiating i [1 of 1] Compiling A ( i/A.hs, bkpfail41.out/i/A.o ) [3 of 3] Processing r - [1 of 1] Compiling B[sig] ( r/B.hsig, nothing ) + [1 of 2] Compiling B[sig] ( r/B.hsig, nothing ) + [2 of 2] Instantiating p bkpfail41.bkp:10:9: error: • Class ‘C’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail42.stderr b/testsuite/tests/backpack/should_fail/bkpfail42.stderr index 5b078910f9..aa6857e9a1 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail42.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail42.stderr @@ -1,7 +1,7 @@ [1 of 2] Processing p [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 2] Processing q - [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) + [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) bkpfail42.bkp:9:9: error: • Type constructor ‘F’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail47.stderr b/testsuite/tests/backpack/should_fail/bkpfail47.stderr index 0eb58d8ee4..d7f7c174d6 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail47.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail47.stderr @@ -3,7 +3,7 @@ [2 of 3] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [3 of 3] Processing r - [1 of 1] Compiling A[sig] ( r/A.hsig, nothing ) + [1 of 3] Compiling A[sig] ( r/A.hsig, nothing ) bkpfail47.bkp:9:9: error: • Type constructor ‘T’ has conflicting definitions in the module diff --git a/testsuite/tests/backpack/should_fail/bkpfail48.stderr b/testsuite/tests/backpack/should_fail/bkpfail48.stderr index cb0740d8bf..27a1f25ac0 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail48.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail48.stderr @@ -1,7 +1,7 @@ [1 of 2] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) [2 of 2] Processing p - [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) bkpfail48.bkp:6:18: error: • The export item ‘module Data.Bool’ is not imported diff --git a/testsuite/tests/backpack/should_fail/bkpfail49.stderr b/testsuite/tests/backpack/should_fail/bkpfail49.stderr index c2236e5375..27892ec8cf 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail49.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail49.stderr @@ -1,8 +1,8 @@ [1 of 2] Processing p [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 2] Processing q - [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) - [2 of 2] Compiling M ( q/M.hs, nothing ) + [1 of 3] Compiling A[sig] ( q/A.hsig, nothing ) + [2 of 3] Compiling M ( q/M.hs, nothing ) bkpfail49.bkp:11:13: error: Not in scope: data constructor ‘A.True’ diff --git a/testsuite/tests/backpack/should_fail/bkpfail50.bkp b/testsuite/tests/backpack/should_fail/bkpfail50.bkp new file mode 100644 index 0000000000..1dda1cb119 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail50.bkp @@ -0,0 +1,8 @@ +unit p where + signature H where + data T = T Int +unit q where + dependency p[H=<A>] + signature A where + data T = T Bool +-- signatures don't merge diff --git a/testsuite/tests/backpack/should_fail/bkpfail50.stderr b/testsuite/tests/backpack/should_fail/bkpfail50.stderr new file mode 100644 index 0000000000..2d4d171ea7 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail50.stderr @@ -0,0 +1,16 @@ +[1 of 2] Processing p + [1 of 1] Compiling H[sig] ( p/H.hsig, nothing ) +[2 of 2] Processing q + [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) + +bkpfail50.bkp:7:9: error: + • Type constructor ‘T’ has conflicting definitions in the module + and its hsig file + Main module: type T :: * + data T = T Bool + Hsig file: type T :: * + data T = T Int + The constructors do not match: The types for ‘T’ differ + • while merging the signatures from: + • p[H=<A>]:H + • ...and the local signature for A diff --git a/testsuite/tests/backpack/should_fail/bkpfail51.bkp b/testsuite/tests/backpack/should_fail/bkpfail51.bkp new file mode 100644 index 0000000000..e8cfe5938d --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail51.bkp @@ -0,0 +1,11 @@ +unit p where + signature H where + data T = T Int + module I(module H) where + import H +unit q where + dependency p[H=<A>] + signature A where + import I + type T = H.T +-- cyclic import diff --git a/testsuite/tests/backpack/should_fail/bkpfail51.stderr b/testsuite/tests/backpack/should_fail/bkpfail51.stderr new file mode 100644 index 0000000000..c732e0bcbf --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail51.stderr @@ -0,0 +1,8 @@ +[1 of 2] Processing p + [1 of 2] Compiling H[sig] ( p/H.hsig, nothing ) + [2 of 2] Compiling I ( p/I.hs, nothing ) +[2 of 2] Processing q +Module imports and instantiations form a cycle: + instantiated unit p[H=A] + imports module ‘A’ (q/A.hsig) + which imports instantiated unit p[H=A] diff --git a/testsuite/tests/backpack/should_fail/bkpfail52.bkp b/testsuite/tests/backpack/should_fail/bkpfail52.bkp new file mode 100644 index 0000000000..da5a3c0822 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail52.bkp @@ -0,0 +1,11 @@ +unit p where + signature H where + data T = T Int +unit q where + dependency p[H=<A>] + module B where + data T = T Bool + signature A where + import qualified B + type T = B.T +-- signatures don't merge diff --git a/testsuite/tests/backpack/should_fail/bkpfail52.stderr b/testsuite/tests/backpack/should_fail/bkpfail52.stderr new file mode 100644 index 0000000000..888434e33c --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail52.stderr @@ -0,0 +1,16 @@ +[1 of 2] Processing p + [1 of 1] Compiling H[sig] ( p/H.hsig, nothing ) +[2 of 2] Processing q + [1 of 3] Compiling B ( q/B.hs, nothing ) + [2 of 3] Compiling A[sig] ( q/A.hsig, nothing ) + +bkpfail52.bkp:10:9: error: + • Type constructor ‘T’ has conflicting definitions in the module + and its hsig file + Main module: type T :: * + type T = B.T + Hsig file: type T :: * + data T = T Int + • while merging the signatures from: + • p[H=<A>]:H + • ...and the local signature for A diff --git a/testsuite/tests/backpack/should_fail/bkpfail53.bkp b/testsuite/tests/backpack/should_fail/bkpfail53.bkp new file mode 100644 index 0000000000..47e7c4593c --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail53.bkp @@ -0,0 +1,21 @@ + +unit p where + signature H where + data T = T Int + module I(module H) where + import H + x :: Int -> T + x = T +unit q where + dependency p[H=<A>] + module B where + data T = T Bool + signature A where + import qualified B + type T = B.T + module C where + import qualified B + import qualified I + x :: Int -> B.T + x = I.x +-- signatures don't merge diff --git a/testsuite/tests/backpack/should_fail/bkpfail53.stderr b/testsuite/tests/backpack/should_fail/bkpfail53.stderr new file mode 100644 index 0000000000..b694bc57ff --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail53.stderr @@ -0,0 +1,17 @@ +[1 of 2] Processing p + [1 of 2] Compiling H[sig] ( p/H.hsig, nothing ) + [2 of 2] Compiling I ( p/I.hs, nothing ) +[2 of 2] Processing q + [1 of 4] Compiling B ( q/B.hs, nothing ) + [2 of 4] Compiling A[sig] ( q/A.hsig, nothing ) + +bkpfail53.bkp:15:9: error: + • Type constructor ‘T’ has conflicting definitions in the module + and its hsig file + Main module: type T :: * + type T = B.T + Hsig file: type T :: * + data T = T Int + • while merging the signatures from: + • p[H=<A>]:H + • ...and the local signature for A |