summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack/reexport
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-02-12 16:02:44 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2017-02-17 13:51:19 -0800
commitfd2d5b6de7493c2ff2ac76401ef296f575c52483 (patch)
tree44142c3ac7e641a1bf7980001136369394245a8a /testsuite/tests/backpack/reexport
parent22dba98f2b22141d8238d7e7a42141495945f1cf (diff)
downloadhaskell-fd2d5b6de7493c2ff2ac76401ef296f575c52483.tar.gz
Improvements/bugfixes to signature reexport handling.
Summary: A number of changes: - Keep the TcGblEnv from typechecking the local signature around when we do merging. In particular, we setup tcg_imports and tcg_rdr_env according to the local signature. This improves our error output (for example, see bkpfail04) and also fixes a bug with reexporting modules in signatures (see bkpreex07) - Fix a bug in thinning, where if we had signature A(module A), this previously would have *thinned out* all of the inherited signatures. Now we treat every inherited signature as having come from an import like "import A", so a module A reexport will pick them up. - Recompilation checking now keeps track of dependent source files of the source signature; previously we forgot to retain this info. There's a manual update too. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3133
Diffstat (limited to 'testsuite/tests/backpack/reexport')
-rw-r--r--testsuite/tests/backpack/reexport/all.T4
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex07.bkp3
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex07.stderr2
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex08.bkp17
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex08.stderr8
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex09.bkp10
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex09.stderr5
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex10.bkp10
-rw-r--r--testsuite/tests/backpack/reexport/bkpreex10.stderr5
9 files changed, 64 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/reexport/all.T b/testsuite/tests/backpack/reexport/all.T
index 55a5004571..5619707e5d 100644
--- a/testsuite/tests/backpack/reexport/all.T
+++ b/testsuite/tests/backpack/reexport/all.T
@@ -5,3 +5,7 @@ test('bkpreex04', normal, backpack_typecheck, [''])
# These signatures are behaving badly and the renamer gets confused
test('bkpreex05', expect_broken(0), backpack_typecheck, [''])
test('bkpreex06', normal, backpack_typecheck, [''])
+test('bkpreex07', normal, backpack_typecheck, [''])
+test('bkpreex08', normal, backpack_typecheck, [''])
+test('bkpreex09', normal, backpack_typecheck, [''])
+test('bkpreex10', normal, backpack_typecheck, [''])
diff --git a/testsuite/tests/backpack/reexport/bkpreex07.bkp b/testsuite/tests/backpack/reexport/bkpreex07.bkp
new file mode 100644
index 0000000000..9cfb539152
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex07.bkp
@@ -0,0 +1,3 @@
+unit p where
+ signature A(module Prelude) where
+ import Prelude
diff --git a/testsuite/tests/backpack/reexport/bkpreex07.stderr b/testsuite/tests/backpack/reexport/bkpreex07.stderr
new file mode 100644
index 0000000000..4852528959
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex07.stderr
@@ -0,0 +1,2 @@
+[1 of 1] Processing p
+ [1 of 1] Compiling A[sig] ( p/A.hsig, nothing )
diff --git a/testsuite/tests/backpack/reexport/bkpreex08.bkp b/testsuite/tests/backpack/reexport/bkpreex08.bkp
new file mode 100644
index 0000000000..596e5ea034
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex08.bkp
@@ -0,0 +1,17 @@
+unit q where
+ module B where
+ f = 2 :: Int
+unit p2 where
+ dependency q
+ signature A(f) where
+ import B
+unit p where
+ dependency q
+ dependency p2[A=<A>]
+ signature A(module A, module Prelude) where
+ import Prelude
+ f :: Int
+ module M where
+ import B
+ import A
+ g = f
diff --git a/testsuite/tests/backpack/reexport/bkpreex08.stderr b/testsuite/tests/backpack/reexport/bkpreex08.stderr
new file mode 100644
index 0000000000..41983efaed
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex08.stderr
@@ -0,0 +1,8 @@
+[1 of 3] Processing q
+ Instantiating q
+ [1 of 1] Compiling B ( q/B.hs, nothing )
+[2 of 3] Processing p2
+ [1 of 1] Compiling A[sig] ( p2/A.hsig, nothing )
+[3 of 3] 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/reexport/bkpreex09.bkp b/testsuite/tests/backpack/reexport/bkpreex09.bkp
new file mode 100644
index 0000000000..5b16c44875
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex09.bkp
@@ -0,0 +1,10 @@
+unit p where
+ signature A where
+ f :: Bool
+unit q where
+ dependency p[A=<A>]
+ signature A(module A) where
+ h :: Bool
+ module M where
+ import A
+ g = f && h
diff --git a/testsuite/tests/backpack/reexport/bkpreex09.stderr b/testsuite/tests/backpack/reexport/bkpreex09.stderr
new file mode 100644
index 0000000000..d4bedc39f5
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex09.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 A[sig] ( q/A.hsig, nothing )
+ [2 of 2] Compiling M ( q/M.hs, nothing )
diff --git a/testsuite/tests/backpack/reexport/bkpreex10.bkp b/testsuite/tests/backpack/reexport/bkpreex10.bkp
new file mode 100644
index 0000000000..4b00e57b5e
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex10.bkp
@@ -0,0 +1,10 @@
+{-# LANGUAGE ConstraintKinds #-}
+unit p where
+ signature A(module Data.Typeable) where
+ import Data.Typeable
+unit q where
+ dependency p[A=<A>]
+ signature A(module A) where
+ module M where
+ import A
+ type X = Typeable
diff --git a/testsuite/tests/backpack/reexport/bkpreex10.stderr b/testsuite/tests/backpack/reexport/bkpreex10.stderr
new file mode 100644
index 0000000000..d4bedc39f5
--- /dev/null
+++ b/testsuite/tests/backpack/reexport/bkpreex10.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 A[sig] ( q/A.hsig, nothing )
+ [2 of 2] Compiling M ( q/M.hs, nothing )