summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-03-28 10:21:15 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-04-02 16:43:47 -0700
commit45d33f35f689192fd74c9954d782e4cee04acfc8 (patch)
treebe0e2775ab0b97d27bba432592a30efb7b8a8fcd /testsuite/tests/backpack
parent0c333c89ffce5c271d3123e612c7ae22a810649e (diff)
downloadhaskell-45d33f35f689192fd74c9954d782e4cee04acfc8.tar.gz
Better test coverage for module reexports in signatures.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'testsuite/tests/backpack')
-rw-r--r--testsuite/tests/backpack/should_compile/all.T2
-rw-r--r--testsuite/tests/backpack/should_compile/bkp54.bkp11
-rw-r--r--testsuite/tests/backpack/should_compile/bkp54.stderr5
-rw-r--r--testsuite/tests/backpack/should_compile/bkp55.bkp11
-rw-r--r--testsuite/tests/backpack/should_compile/bkp55.stderr5
-rw-r--r--testsuite/tests/backpack/should_fail/all.T2
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail48.bkp7
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail48.stderr10
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail49.bkp11
-rw-r--r--testsuite/tests/backpack/should_fail/bkpfail49.stderr9
10 files changed, 73 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T
index 477c0fe220..da6ea5fb07 100644
--- a/testsuite/tests/backpack/should_compile/all.T
+++ b/testsuite/tests/backpack/should_compile/all.T
@@ -45,6 +45,8 @@ test('bkp50', normal, backpack_compile, [''])
test('bkp51', normal, backpack_compile, [''])
test('bkp52', normal, backpack_compile, [''])
test('bkp53', normal, backpack_compile, [''])
+test('bkp54', normal, backpack_compile, [''])
+test('bkp55', normal, backpack_compile, [''])
test('T13140', normal, backpack_compile, [''])
test('T13149', expect_broken(13149), backpack_compile, [''])
diff --git a/testsuite/tests/backpack/should_compile/bkp54.bkp b/testsuite/tests/backpack/should_compile/bkp54.bkp
new file mode 100644
index 0000000000..6cf12702b2
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp54.bkp
@@ -0,0 +1,11 @@
+unit q where
+ signature A (module N) where
+ import qualified Data.Bool as N
+unit p where
+ dependency signature q[A=<A>]
+ signature A (module A, module Data.Word) where
+ import Data.Word
+ module M where
+ import qualified A
+ x = A.otherwise
+ type T = A.Word
diff --git a/testsuite/tests/backpack/should_compile/bkp54.stderr b/testsuite/tests/backpack/should_compile/bkp54.stderr
new file mode 100644
index 0000000000..f3aafc1258
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp54.stderr
@@ -0,0 +1,5 @@
+[1 of 2] Processing q
+ [1 of 1] Compiling A[sig] ( q/A.hsig, nothing )
+[2 of 2] Processing p
+ [1 of 2] Compiling A[sig] ( p/A.hsig, nothing )
+ [2 of 2] Compiling M ( p/M.hs, nothing )
diff --git a/testsuite/tests/backpack/should_compile/bkp55.bkp b/testsuite/tests/backpack/should_compile/bkp55.bkp
new file mode 100644
index 0000000000..d9c7370b3f
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp55.bkp
@@ -0,0 +1,11 @@
+unit p where
+ signature A where
+ p :: Int
+
+unit q where
+ dependency signature p[A=<B>]
+ signature B (module B) where
+ q :: Int
+ module M where
+ import B
+ f = p + q
diff --git a/testsuite/tests/backpack/should_compile/bkp55.stderr b/testsuite/tests/backpack/should_compile/bkp55.stderr
new file mode 100644
index 0000000000..9213c9c84f
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp55.stderr
@@ -0,0 +1,5 @@
+[1 of 2] Processing p
+ [1 of 1] Compiling A[sig] ( p/A.hsig, nothing )
+[2 of 2] Processing q
+ [1 of 2] Compiling B[sig] ( q/B.hsig, nothing )
+ [2 of 2] Compiling M ( q/M.hs, nothing )
diff --git a/testsuite/tests/backpack/should_fail/all.T b/testsuite/tests/backpack/should_fail/all.T
index e1416fcec8..856733ec0b 100644
--- a/testsuite/tests/backpack/should_fail/all.T
+++ b/testsuite/tests/backpack/should_fail/all.T
@@ -43,3 +43,5 @@ test('bkpfail44', normal, backpack_compile_fail, [''])
test('bkpfail45', normal, backpack_compile_fail, [''])
test('bkpfail46', normal, backpack_compile_fail, [''])
test('bkpfail47', normal, backpack_compile_fail, [''])
+test('bkpfail48', normal, backpack_compile_fail, [''])
+test('bkpfail49', normal, backpack_compile_fail, [''])
diff --git a/testsuite/tests/backpack/should_fail/bkpfail48.bkp b/testsuite/tests/backpack/should_fail/bkpfail48.bkp
new file mode 100644
index 0000000000..e66100ddca
--- /dev/null
+++ b/testsuite/tests/backpack/should_fail/bkpfail48.bkp
@@ -0,0 +1,7 @@
+unit q where
+ signature A (module Data.Bool) where
+ import Data.Bool
+unit p where
+ dependency signature q[A=<A>]
+ signature A (module Data.Bool) where
+ -- This should not work: module is mandatory
diff --git a/testsuite/tests/backpack/should_fail/bkpfail48.stderr b/testsuite/tests/backpack/should_fail/bkpfail48.stderr
new file mode 100644
index 0000000000..9c991d6fc9
--- /dev/null
+++ b/testsuite/tests/backpack/should_fail/bkpfail48.stderr
@@ -0,0 +1,10 @@
+[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 )
+
+bkpfail48.bkp:6:18: error:
+ • The export item `module Data.Bool' is not imported
+ • while merging the signatures from:
+ • q[A=<A>]:A
+ • ...and the local signature for A
diff --git a/testsuite/tests/backpack/should_fail/bkpfail49.bkp b/testsuite/tests/backpack/should_fail/bkpfail49.bkp
new file mode 100644
index 0000000000..a30a1f8618
--- /dev/null
+++ b/testsuite/tests/backpack/should_fail/bkpfail49.bkp
@@ -0,0 +1,11 @@
+unit p where
+ signature A (module Data.Bool) where
+ import Data.Bool
+
+unit q where
+ dependency signature p[A=<A>]
+ signature A (module Data.Bool) where
+ import Data.Bool ()
+ module M where
+ import qualified A
+ x = A.True -- should not exist!
diff --git a/testsuite/tests/backpack/should_fail/bkpfail49.stderr b/testsuite/tests/backpack/should_fail/bkpfail49.stderr
new file mode 100644
index 0000000000..c2236e5375
--- /dev/null
+++ b/testsuite/tests/backpack/should_fail/bkpfail49.stderr
@@ -0,0 +1,9 @@
+[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 )
+
+bkpfail49.bkp:11:13: error:
+ Not in scope: data constructor ‘A.True’
+ Module ‘A’ does not export ‘True’.