summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/deriving/should_fail/T21087.hs11
-rw-r--r--testsuite/tests/deriving/should_fail/T21087.stderr4
-rw-r--r--testsuite/tests/deriving/should_fail/T21087b.hs3
-rw-r--r--testsuite/tests/deriving/should_fail/T21087b.stderr10
-rw-r--r--testsuite/tests/deriving/should_fail/T21087b_aux.hs11
-rw-r--r--testsuite/tests/deriving/should_fail/T21087b_aux.hs-boot11
-rw-r--r--testsuite/tests/deriving/should_fail/all.T2
7 files changed, 52 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_fail/T21087.hs b/testsuite/tests/deriving/should_fail/T21087.hs
new file mode 100644
index 0000000000..730dbac153
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T21087.hs
@@ -0,0 +1,11 @@
+{-# language DataKinds #-}
+{-# language DerivingVia #-}
+{-# language TypeFamilies #-}
+
+module T21087 where
+
+import GHC.TypeLits
+
+data family Z :: k
+
+deriving via 0 instance KnownNat Z
diff --git a/testsuite/tests/deriving/should_fail/T21087.stderr b/testsuite/tests/deriving/should_fail/T21087.stderr
new file mode 100644
index 0000000000..8e40f6e641
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T21087.stderr
@@ -0,0 +1,4 @@
+
+T21087.hs:11:25: error:
+ • Class ‘KnownNat’ does not support user-specified instances.
+ • In the stand-alone deriving instance for ‘KnownNat Z’
diff --git a/testsuite/tests/deriving/should_fail/T21087b.hs b/testsuite/tests/deriving/should_fail/T21087b.hs
new file mode 100644
index 0000000000..522c1603a7
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T21087b.hs
@@ -0,0 +1,3 @@
+module T21087b where
+
+import {-# SOURCE #-} T21087b_aux
diff --git a/testsuite/tests/deriving/should_fail/T21087b.stderr b/testsuite/tests/deriving/should_fail/T21087b.stderr
new file mode 100644
index 0000000000..4caee4928e
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T21087b.stderr
@@ -0,0 +1,10 @@
+[1 of 3] Compiling T21087b_aux[boot] ( T21087b_aux.hs-boot, T21087b_aux.o-boot )
+
+T21087b_aux.hs-boot:11:25: error:
+ • Class ‘KnownNat’ does not support user-specified instances.
+ • In the stand-alone deriving instance for ‘KnownNat Z’
+[3 of 3] Compiling T21087b_aux ( T21087b_aux.hs, T21087b_aux.o )
+
+T21087b_aux.hs:11:25: error:
+ • Class ‘KnownNat’ does not support user-specified instances.
+ • In the stand-alone deriving instance for ‘KnownNat Z’
diff --git a/testsuite/tests/deriving/should_fail/T21087b_aux.hs b/testsuite/tests/deriving/should_fail/T21087b_aux.hs
new file mode 100644
index 0000000000..2cccf704ea
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T21087b_aux.hs
@@ -0,0 +1,11 @@
+{-# language DataKinds #-}
+{-# language DerivingVia #-}
+{-# language TypeFamilies #-}
+
+module T21087b_aux where
+
+import GHC.TypeLits
+
+data family Z :: k
+
+deriving via 0 instance KnownNat Z
diff --git a/testsuite/tests/deriving/should_fail/T21087b_aux.hs-boot b/testsuite/tests/deriving/should_fail/T21087b_aux.hs-boot
new file mode 100644
index 0000000000..2cccf704ea
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T21087b_aux.hs-boot
@@ -0,0 +1,11 @@
+{-# language DataKinds #-}
+{-# language DerivingVia #-}
+{-# language TypeFamilies #-}
+
+module T21087b_aux where
+
+import GHC.TypeLits
+
+data family Z :: k
+
+deriving via 0 instance KnownNat Z
diff --git a/testsuite/tests/deriving/should_fail/all.T b/testsuite/tests/deriving/should_fail/all.T
index 70bd0f9dbe..61d74b72b4 100644
--- a/testsuite/tests/deriving/should_fail/all.T
+++ b/testsuite/tests/deriving/should_fail/all.T
@@ -80,3 +80,5 @@ test('deriving-via-fail2', normal, compile_fail, [''])
test('deriving-via-fail3', normal, compile_fail, [''])
test('deriving-via-fail4', normal, compile_fail, [''])
test('deriving-via-fail5', normal, compile_fail, [''])
+test('T21087', normal, compile_fail, [''])
+test('T21087b', [extra_files(['T21087b_aux.hs','T21087b_aux.hs-boot'])], multimod_compile_fail, ['T21087b', ''])