diff options
author | Reid Barton <rwbarton@gmail.com> | 2017-01-23 21:59:39 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-01-23 22:05:53 -0500 |
commit | 8f49f6de2121541d3bf8254abb402b6e7bfee8fb (patch) | |
tree | 0467276635bd9afef1eed06c3b0ddeefe1140f23 | |
parent | a8c81f3c102988e0f4216b7cb5fec7958e60b4e4 (diff) | |
download | haskell-8f49f6de2121541d3bf8254abb402b6e7bfee8fb.tar.gz |
Add a failing test for #13102
Test Plan: harbormaster
Reviewers: austin, ezyang, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3005
GHC Trac Issues: #13102
9 files changed, 60 insertions, 0 deletions
diff --git a/testsuite/tests/indexed-types/should_fail/T13102/A.hs b/testsuite/tests/indexed-types/should_fail/T13102/A.hs new file mode 100644 index 0000000000..7dd43481dc --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/A.hs @@ -0,0 +1,6 @@ +module A where + +import O + +x _ = 1 -- Generate a silly warning, so we know A was really compiled +x _ = 2 -- (and thus the reason B fails is that the bug is fixed) diff --git a/testsuite/tests/indexed-types/should_fail/T13102/B.hs b/testsuite/tests/indexed-types/should_fail/T13102/B.hs new file mode 100644 index 0000000000..ab8832b92c --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/B.hs @@ -0,0 +1,6 @@ +module B where + +import F + +f :: F Int -> Bool +f = id diff --git a/testsuite/tests/indexed-types/should_fail/T13102/Makefile b/testsuite/tests/indexed-types/should_fail/T13102/Makefile new file mode 100644 index 0000000000..b4cbff9205 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/Makefile @@ -0,0 +1,13 @@ +TOP=../../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +LOCAL_PKGCONF=local.package.conf + +T13102: + "$(GHC_PKG)" init $(LOCAL_PKGCONF) + cd orphan && "$(TEST_HC)" -v0 --make Setup.hs + cd orphan && ./Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) + cd orphan && ./Setup build -v0 + cd orphan && ./Setup register -v0 --inplace + ! "$(TEST_HC)" $(TEST_HC_OPTS) -c A.hs B.hs -package-db $(LOCAL_PKGCONF) diff --git a/testsuite/tests/indexed-types/should_fail/T13102/T13102.stderr b/testsuite/tests/indexed-types/should_fail/T13102/T13102.stderr new file mode 100644 index 0000000000..e884cba426 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/T13102.stderr @@ -0,0 +1,11 @@ + +A.hs:6:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In an equation for ‘x’: x _ = ... + +B.hs:6:5: error: + • Couldn't match type ‘F Int’ with ‘Bool’ + Expected type: F Int -> Bool + Actual type: Bool -> Bool + • In the expression: id + In an equation for ‘f’: f = id diff --git a/testsuite/tests/indexed-types/should_fail/T13102/all.T b/testsuite/tests/indexed-types/should_fail/T13102/all.T new file mode 100644 index 0000000000..bdde35430e --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/all.T @@ -0,0 +1,5 @@ +# Test that we don't use a family instance that we didn't import + +test('T13102', [expect_broken(13102), + extra_files(['A.hs', 'B.hs', 'orphan'])], + run_command, ['$MAKE -s --no-print-directory T13102']) diff --git a/testsuite/tests/indexed-types/should_fail/T13102/orphan/F.hs b/testsuite/tests/indexed-types/should_fail/T13102/orphan/F.hs new file mode 100644 index 0000000000..7e1ecf4efb --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/orphan/F.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TypeFamilies #-} + +module F where + +type family F a :: * diff --git a/testsuite/tests/indexed-types/should_fail/T13102/orphan/O.hs b/testsuite/tests/indexed-types/should_fail/T13102/orphan/O.hs new file mode 100644 index 0000000000..b8608ec796 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/orphan/O.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} + +module O where + +import F + +type instance F Int = Bool diff --git a/testsuite/tests/indexed-types/should_fail/T13102/orphan/Setup.hs b/testsuite/tests/indexed-types/should_fail/T13102/orphan/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/orphan/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/testsuite/tests/indexed-types/should_fail/T13102/orphan/orphan.cabal b/testsuite/tests/indexed-types/should_fail/T13102/orphan/orphan.cabal new file mode 100644 index 0000000000..c6a6ea0792 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13102/orphan/orphan.cabal @@ -0,0 +1,5 @@ +name: orphan +version: 1.0 +exposed-modules: F, O +build-depends: base +build-type: Simple |