summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBaldur Blöndal <baldurpet@gmail.com>2020-05-03 10:43:14 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-04 01:57:36 -0400
commit0bf640b19d7a7ad0800152752a71c1dd4e6c696d (patch)
treead8752d12261517520765da174f95a68e81f3bcc /testsuite
parent8bdc03d61cb7a2f96887c86bd0b253f7c108fcde (diff)
downloadhaskell-0bf640b19d7a7ad0800152752a71c1dd4e6c696d.tar.gz
Don't require parentheses around via type (`-XDerivingVia'). Fixes #18130".
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/parser/should_compile/T18130.hs20
-rw-r--r--testsuite/tests/parser/should_compile/all.T1
-rw-r--r--testsuite/tests/parser/should_fail/T18130Fail.hs20
-rw-r--r--testsuite/tests/parser/should_fail/T18130Fail.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/all.T1
5 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_compile/T18130.hs b/testsuite/tests/parser/should_compile/T18130.hs
new file mode 100644
index 0000000000..a796de7a39
--- /dev/null
+++ b/testsuite/tests/parser/should_compile/T18130.hs
@@ -0,0 +1,20 @@
+{-# Language DerivingVia #-}
+{-# Language KindSignatures #-}
+
+module T18130 where
+
+import Data.Functor.Classes
+import Data.Kind
+
+newtype Par a b = Par (a, b)
+ deriving Eq
+ via (a, b)
+ :: Type
+
+ deriving Eq1
+ via (,) a
+ :: Type -> Type
+
+ deriving Eq2
+ via (,)
+ :: Type -> Type -> Type
diff --git a/testsuite/tests/parser/should_compile/all.T b/testsuite/tests/parser/should_compile/all.T
index 1568a341ec..8c7f058062 100644
--- a/testsuite/tests/parser/should_compile/all.T
+++ b/testsuite/tests/parser/should_compile/all.T
@@ -166,3 +166,4 @@ test('proposal-229f',
multimod_compile_and_run, ['proposal-229f.hs', ''])
test('T15730a', normal, compile_and_run, [''])
+test('T18130', normal, compile, [''])
diff --git a/testsuite/tests/parser/should_fail/T18130Fail.hs b/testsuite/tests/parser/should_fail/T18130Fail.hs
new file mode 100644
index 0000000000..dfd1389b80
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T18130Fail.hs
@@ -0,0 +1,20 @@
+{-# Language DerivingVia #-}
+{-# Language KindSignatures #-}
+
+module T18130Fail where
+
+import Data.Functor.Classes
+import Data.Kind
+
+newtype Par a b = Par (a, b)
+ deriving Eq
+ via (a, b)
+ :: Type -> Type
+
+ deriving Eq1
+ via (,) a
+ :: Type -> Type
+
+ deriving Eq2
+ via (,)
+ :: Type -> Type -> Type
diff --git a/testsuite/tests/parser/should_fail/T18130Fail.stderr b/testsuite/tests/parser/should_fail/T18130Fail.stderr
new file mode 100644
index 0000000000..60887b0799
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T18130Fail.stderr
@@ -0,0 +1,4 @@
+
+T18130Fail.hs:11:7: error:
+ • Expected kind ‘* -> *’, but ‘(a, b)’ has kind ‘*’
+ • In the newtype declaration for ‘Par’
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
index c6d691bed3..9d71019f3e 100644
--- a/testsuite/tests/parser/should_fail/all.T
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -166,3 +166,4 @@ test('T17162', normal, compile_fail, [''])
test('proposal-229c', normal, compile_fail, [''])
test('T15730', normal, compile_fail, [''])
test('T15730b', normal, compile_fail, [''])
+test('T18130Fail', normal, compile_fail, [''])