summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack/should_compile
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-12-29 18:58:22 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-01-11 06:53:54 -0800
commit9f169bcd951c5d946698d5f33a0cdb625d725490 (patch)
treef56304dc31f19454d4ff72d5188b0aabf2ca65b7 /testsuite/tests/backpack/should_compile
parent5f9c6d2a91ac710e7b75cfe50a7a8e84cc9ae796 (diff)
downloadhaskell-9f169bcd951c5d946698d5f33a0cdb625d725490.tar.gz
Attach warnings to non-PVP compatible uses of signatures.
Summary: If you use an inherited signature from another package in your own code, the only valid PVP bound you can specify for this package is an *exact* version bound. This is because the signature is used both covariantly (it provides declarations for import) and contravariantly (it specifies what is required). However, this is a bit distressing if you want to use a PVP-style bound that allows for upgrading a package. So there is a dichotomy: 1. Any signatures that come from packages with exact bounds (this includes, in particular, signature packages, who are included solely to make declarations available), can be used without problem by modules, but 2. Any signatures that come from packages that are version bounded (i.e., any package that also provides modules) must NOT be used, because if they were used, they could break under a PVP policy that allows relaxations in the needed requirements. To help users avoid situation (2), I've added a warning to all signature declarations that come solely from (2). This is not perfect; you might still end up relying on some type identity specified by a signature in a version-bounded package, but it should help catch major errors. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2906
Diffstat (limited to 'testsuite/tests/backpack/should_compile')
-rw-r--r--testsuite/tests/backpack/should_compile/bkp10.stderr4
-rw-r--r--testsuite/tests/backpack/should_compile/bkp11.stderr8
-rw-r--r--testsuite/tests/backpack/should_compile/bkp24.stderr4
-rw-r--r--testsuite/tests/backpack/should_compile/bkp36.stderr4
4 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/should_compile/bkp10.stderr b/testsuite/tests/backpack/should_compile/bkp10.stderr
index 350670e6d4..13c33f363f 100644
--- a/testsuite/tests/backpack/should_compile/bkp10.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp10.stderr
@@ -4,3 +4,7 @@
[2 of 2] Processing q
[1 of 2] Compiling H2[sig] ( q/H2.hsig, nothing )
[2 of 2] Compiling B ( q/B.hs, nothing )
+
+bkp10.bkp:13:18: warning: [-Wdeprecations (in -Wdefault)]
+ In the use of type constructor or class ‘S’ (imported from H2):
+ "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency."
diff --git a/testsuite/tests/backpack/should_compile/bkp11.stderr b/testsuite/tests/backpack/should_compile/bkp11.stderr
index a804563b2d..ca45b493d3 100644
--- a/testsuite/tests/backpack/should_compile/bkp11.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp11.stderr
@@ -5,3 +5,11 @@
[2 of 2] Processing q
[1 of 2] Compiling H[sig] ( q/H.hsig, nothing )
[2 of 2] Compiling B ( q/B.hs, nothing )
+
+bkp11.bkp:16:14: warning: [-Wdeprecations (in -Wdefault)]
+ In the use of type constructor or class ‘S’ (imported from H):
+ "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency."
+
+bkp11.bkp:16:19: warning: [-Wdeprecations (in -Wdefault)]
+ In the use of type constructor or class ‘T’ (imported from H):
+ "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency."
diff --git a/testsuite/tests/backpack/should_compile/bkp24.stderr b/testsuite/tests/backpack/should_compile/bkp24.stderr
index ddafe4150b..fbde703f49 100644
--- a/testsuite/tests/backpack/should_compile/bkp24.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp24.stderr
@@ -11,6 +11,10 @@
[4 of 5] Processing q
[1 of 2] Compiling B[sig] ( q/B.hsig, nothing )
[2 of 2] Compiling Q ( q/Q.hs, nothing )
+
+bkp24.bkp:23:24: warning: [-Wdeprecations (in -Wdefault)]
+ In the use of type constructor or class ‘B’ (imported from B):
+ "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency."
[5 of 5] Processing r
Instantiating r
[1 of 2] Including q[B=b:B]
diff --git a/testsuite/tests/backpack/should_compile/bkp36.stderr b/testsuite/tests/backpack/should_compile/bkp36.stderr
index 45ade1412f..c891ab476b 100644
--- a/testsuite/tests/backpack/should_compile/bkp36.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp36.stderr
@@ -7,3 +7,7 @@
[3 of 3] Processing q
[1 of 2] Compiling B[sig] ( q/B.hsig, nothing )
[2 of 2] Compiling Q ( q/Q.hs, nothing )
+
+bkp36.bkp:20:16: warning: [-Wdeprecations (in -Wdefault)]
+ In the use of type constructor or class ‘T’ (imported from B):
+ "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency."