[commit: ghc] master: Better test coverage for module reexports in signatures. (45d33f3)

git at git.haskell.org git at git.haskell.org
Sun Apr 2 23:49:49 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/45d33f35f689192fd74c9954d782e4cee04acfc8/ghc

>---------------------------------------------------------------

commit 45d33f35f689192fd74c9954d782e4cee04acfc8
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Tue Mar 28 10:21:15 2017 -0700

    Better test coverage for module reexports in signatures.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>


>---------------------------------------------------------------

45d33f35f689192fd74c9954d782e4cee04acfc8
 testsuite/tests/backpack/should_compile/all.T                |  2 ++
 testsuite/tests/backpack/should_compile/bkp54.bkp            | 11 +++++++++++
 testsuite/tests/backpack/should_compile/bkp54.stderr         |  5 +++++
 testsuite/tests/backpack/should_compile/bkp55.bkp            | 11 +++++++++++
 .../bkpreex09.stderr => should_compile/bkp55.stderr}         |  2 +-
 testsuite/tests/backpack/should_fail/all.T                   |  2 ++
 testsuite/tests/backpack/should_fail/bkpfail48.bkp           |  7 +++++++
 .../should_fail/{bkpfail33.stderr => bkpfail48.stderr}       | 12 ++++++------
 testsuite/tests/backpack/should_fail/bkpfail49.bkp           | 11 +++++++++++
 .../bkpreex09.stderr => should_fail/bkpfail49.stderr}        |  4 ++++
 10 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T
index 477c0fe..da6ea5f 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 0000000..6cf1270
--- /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 0000000..f3aafc1
--- /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 0000000..d9c7370
--- /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/reexport/bkpreex09.stderr b/testsuite/tests/backpack/should_compile/bkp55.stderr
similarity index 72%
copy from testsuite/tests/backpack/reexport/bkpreex09.stderr
copy to testsuite/tests/backpack/should_compile/bkp55.stderr
index d4bedc3..9213c9c 100644
--- a/testsuite/tests/backpack/reexport/bkpreex09.stderr
+++ b/testsuite/tests/backpack/should_compile/bkp55.stderr
@@ -1,5 +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 A[sig]           ( q/A.hsig, nothing )
+  [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 e1416fc..856733e 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 0000000..e66100d
--- /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/bkpfail33.stderr b/testsuite/tests/backpack/should_fail/bkpfail48.stderr
similarity index 57%
copy from testsuite/tests/backpack/should_fail/bkpfail33.stderr
copy to testsuite/tests/backpack/should_fail/bkpfail48.stderr
index 4da8897..9c991d6 100644
--- a/testsuite/tests/backpack/should_fail/bkpfail33.stderr
+++ b/testsuite/tests/backpack/should_fail/bkpfail48.stderr
@@ -1,10 +1,10 @@
-[1 of 2] Processing p
-  [1 of 1] Compiling A[sig]           ( p/A.hsig, nothing )
-[2 of 2] Processing q
+[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 )
 
-bkpfail33.bkp:5:18: error:
-    • Not in scope: type constructor or class ‘T’
+bkpfail48.bkp:6:18: error:
+    • The export item `module Data.Bool' is not imported
     • while merging the signatures from:
-        • p[A=<A>]:A
+        • 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 0000000..a30a1f8
--- /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/reexport/bkpreex09.stderr b/testsuite/tests/backpack/should_fail/bkpfail49.stderr
similarity index 64%
copy from testsuite/tests/backpack/reexport/bkpreex09.stderr
copy to testsuite/tests/backpack/should_fail/bkpfail49.stderr
index d4bedc3..c2236e5 100644
--- a/testsuite/tests/backpack/reexport/bkpreex09.stderr
+++ b/testsuite/tests/backpack/should_fail/bkpfail49.stderr
@@ -3,3 +3,7 @@
 [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’.



More information about the ghc-commits mailing list