summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-03-05 20:33:51 -0500
committerBen Gamari <ben@smart-cactus.org>2019-03-06 14:03:37 -0500
commit633c43e3ad8eb5725b92b4c359e45ab8133060a3 (patch)
tree90c50c0388f4cd5b57272201bb6b032474d3ad05
parent646b6dfbe125aa756a935e840979ba11b4a882c0 (diff)
downloadhaskell-wip/T16394.tar.gz
testsuite: Add testcase for #16394wip/T16394
-rw-r--r--testsuite/tests/typecheck/should_fail/T16394.hs12
-rw-r--r--testsuite/tests/typecheck/should_fail/T16394.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
3 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T16394.hs b/testsuite/tests/typecheck/should_fail/T16394.hs
new file mode 100644
index 0000000000..76ca7a7cf6
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T16394.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE PolyKinds, TypeFamilies, DataKinds #-}
+
+class C a where
+ type T (n :: a)
+
+instance C a => C b => C (a, b) where
+ type T '(n, m) = (T n, T m)
+
+-- but this worked fine:
+--
+-- instance (C a, C b) => C (a, b) where
+-- type T '(n, m) = (T n, T m)
diff --git a/testsuite/tests/typecheck/should_fail/T16394.stderr b/testsuite/tests/typecheck/should_fail/T16394.stderr
new file mode 100644
index 0000000000..fff51a6e39
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T16394.stderr
@@ -0,0 +1,5 @@
+T16394.hs:6:10: error:
+ Illegal class instance: ā€˜C a => C b => C (a, b)ā€™
+ Class instances must be of the form
+ context => C ty_1 ... ty_n
+ where ā€˜Cā€™ is a class
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 1a775d3a7c..b92d99ce8f 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -510,3 +510,4 @@ test('T16059e', [extra_files(['T16059b.hs'])], multimod_compile_fail,
['T16059e', '-v0'])
test('T16255', normal, compile_fail, [''])
test('T16204c', normal, compile_fail, [''])
+test('T16394', normal, compile, [''])