summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-10-15 11:12:24 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-19 03:31:27 -0400
commit53c0e771afa97083ce2addf8d30c7526025869a5 (patch)
tree03e6a8d7fc910ba78c85e67e23384f019c942a83
parent7271bf78a9ffd865e590f1ce3f3ae975f5dc1a49 (diff)
downloadhaskell-53c0e771afa97083ce2addf8d30c7526025869a5.tar.gz
Add test for T20509
This test checks to see whether a signature can depend on another home module. Whether it should or not is up for debate, see #20509 for more details.
-rw-r--r--testsuite/tests/backpack/cabal/T20509/Makefile27
-rw-r--r--testsuite/tests/backpack/cabal/T20509/Setup.hs2
-rw-r--r--testsuite/tests/backpack/cabal/T20509/T20509.cabal23
-rw-r--r--testsuite/tests/backpack/cabal/T20509/all.T10
-rw-r--r--testsuite/tests/backpack/cabal/T20509/p/A.hs3
-rw-r--r--testsuite/tests/backpack/cabal/T20509/p/H.hsig3
-rw-r--r--testsuite/tests/backpack/cabal/T20509/q/B.hs5
-rw-r--r--testsuite/tests/backpack/cabal/T20509/q/H2.hsig4
-rw-r--r--testsuite/tests/backpack/cabal/T20509/q/L.hs3
9 files changed, 80 insertions, 0 deletions
diff --git a/testsuite/tests/backpack/cabal/T20509/Makefile b/testsuite/tests/backpack/cabal/T20509/Makefile
new file mode 100644
index 0000000000..7d20e83135
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/Makefile
@@ -0,0 +1,27 @@
+TOP=../../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+SETUP=./Setup -v0
+CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=tmp.d --prefix='$(PWD)/inst'
+
+T20509: clean
+ $(MAKE) -s --no-print-directory clean
+ '$(GHC_PKG)' init tmp.d
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
+ # typecheck p
+ $(CONFIGURE) --cid "p-0.1" p
+ $(SETUP) build
+ $(SETUP) copy
+ $(SETUP) register
+ # typecheck q
+ $(CONFIGURE) --cid "q-0.1" q
+ $(SETUP) build
+ $(SETUP) copy
+ $(SETUP) register
+ifneq "$(CLEANUP)" ""
+ $(MAKE) -s --no-print-directory clean
+endif
+
+clean :
+ $(RM) -r tmp.d inst dist Setup$(exeext)
diff --git a/testsuite/tests/backpack/cabal/T20509/Setup.hs b/testsuite/tests/backpack/cabal/T20509/Setup.hs
new file mode 100644
index 0000000000..9a994af677
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/testsuite/tests/backpack/cabal/T20509/T20509.cabal b/testsuite/tests/backpack/cabal/T20509/T20509.cabal
new file mode 100644
index 0000000000..f26ab29d66
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/T20509.cabal
@@ -0,0 +1,23 @@
+cabal-version: 3.0
+name: T20509
+version: 0
+build-type: Simple
+
+common common
+ build-depends: base
+ ghc-options: -Wall
+
+library p
+ import: common
+ hs-source-dirs: p
+ signatures: H
+ exposed-modules: A
+
+library q
+ import: common
+ hs-source-dirs: q
+ build-depends: p
+ signatures: H2
+ exposed-modules: L, B
+ mixins:
+ p (A as A2) requires (H as H2)
diff --git a/testsuite/tests/backpack/cabal/T20509/all.T b/testsuite/tests/backpack/cabal/T20509/all.T
new file mode 100644
index 0000000000..d94879a8d7
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/all.T
@@ -0,0 +1,10 @@
+if config.cleanup:
+ cleanup = 'CLEANUP=1'
+else:
+ cleanup = 'CLEANUP=0'
+
+test('T20509',
+ [extra_files(['p', 'q', 'T20509.cabal', 'Setup.hs']),
+ run_timeout_multiplier(2)],
+ run_command,
+ ['$MAKE -s --no-print-directory T20509 ' + cleanup])
diff --git a/testsuite/tests/backpack/cabal/T20509/p/A.hs b/testsuite/tests/backpack/cabal/T20509/p/A.hs
new file mode 100644
index 0000000000..6be0e516e5
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/p/A.hs
@@ -0,0 +1,3 @@
+module A where
+ import H
+ data T = T S1 S2
diff --git a/testsuite/tests/backpack/cabal/T20509/p/H.hsig b/testsuite/tests/backpack/cabal/T20509/p/H.hsig
new file mode 100644
index 0000000000..37b8071c5c
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/p/H.hsig
@@ -0,0 +1,3 @@
+signature H where
+ data S1
+ data S2
diff --git a/testsuite/tests/backpack/cabal/T20509/q/B.hs b/testsuite/tests/backpack/cabal/T20509/q/B.hs
new file mode 100644
index 0000000000..c4757b8d61
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/q/B.hs
@@ -0,0 +1,5 @@
+module B where
+ import A2
+ import H2
+ t :: S1 -> S2 -> T
+ t = T :: S1 -> S2 -> T
diff --git a/testsuite/tests/backpack/cabal/T20509/q/H2.hsig b/testsuite/tests/backpack/cabal/T20509/q/H2.hsig
new file mode 100644
index 0000000000..e52c45a6e6
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/q/H2.hsig
@@ -0,0 +1,4 @@
+signature H2 (S1(MkS1),S2, f) where
+ import L(S1(..))
+ data S2
+ f :: S1 -> S1
diff --git a/testsuite/tests/backpack/cabal/T20509/q/L.hs b/testsuite/tests/backpack/cabal/T20509/q/L.hs
new file mode 100644
index 0000000000..669e391739
--- /dev/null
+++ b/testsuite/tests/backpack/cabal/T20509/q/L.hs
@@ -0,0 +1,3 @@
+module L where
+ data S1 = MkS1
+