summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-05-02 20:15:00 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-06 04:41:57 -0400
commitedec6a6c205378caf15d1d874d7e901ba76dd293 (patch)
tree653e58c01348b948c33472f6fb594649c45ef00a /testsuite/tests/deriving
parent9f3e6884e338015f2953c4c0844e04d467f53dd5 (diff)
downloadhaskell-edec6a6c205378caf15d1d874d7e901ba76dd293.tar.gz
Make isTauTy detect higher-rank contexts
Previously, `isTauTy` would only detect higher-rank `forall`s, not higher-rank contexts, which led to some minor bugs observed in #18127. Easily fixed by adding a case for `(FunTy InvisArg _ _)`. Fixes #18127.
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r--testsuite/tests/deriving/should_fail/T18127b.hs8
-rw-r--r--testsuite/tests/deriving/should_fail/T18127b.stderr22
-rw-r--r--testsuite/tests/deriving/should_fail/all.T1
3 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_fail/T18127b.hs b/testsuite/tests/deriving/should_fail/T18127b.hs
new file mode 100644
index 0000000000..b7aa39abf6
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T18127b.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE RankNTypes #-}
+module T18127b where
+
+import GHC.Generics
+
+data T1 = MkT1 (forall a. a) deriving (Eq, Generic)
+data T2 a = MkT2 (Show a => a) deriving (Eq, Generic)
diff --git a/testsuite/tests/deriving/should_fail/T18127b.stderr b/testsuite/tests/deriving/should_fail/T18127b.stderr
new file mode 100644
index 0000000000..9d2a289e44
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T18127b.stderr
@@ -0,0 +1,22 @@
+
+T18127b.hs:7:40: error:
+ • Can't make a derived instance of ‘Eq T1’:
+ Constructor ‘MkT1’ has a higher-rank type
+ Possible fix: use a standalone deriving declaration instead
+ • In the data declaration for ‘T1’
+
+T18127b.hs:7:44: error:
+ • Can't make a derived instance of ‘Generic T1’:
+ MkT1 must not have exotic unlifted or polymorphic arguments
+ • In the data declaration for ‘T1’
+
+T18127b.hs:8:42: error:
+ • Can't make a derived instance of ‘Eq (T2 a)’:
+ Constructor ‘MkT2’ has a higher-rank type
+ Possible fix: use a standalone deriving declaration instead
+ • In the data declaration for ‘T2’
+
+T18127b.hs:8:46: error:
+ • Can't make a derived instance of ‘Generic (T2 a)’:
+ MkT2 must not have exotic unlifted or polymorphic arguments
+ • In the data declaration for ‘T2’
diff --git a/testsuite/tests/deriving/should_fail/all.T b/testsuite/tests/deriving/should_fail/all.T
index d195a08691..4743d3530d 100644
--- a/testsuite/tests/deriving/should_fail/all.T
+++ b/testsuite/tests/deriving/should_fail/all.T
@@ -76,6 +76,7 @@ test('T15073', [extra_files(['T15073a.hs'])], multimod_compile_fail,
['T15073', '-v0'])
test('T16181', normal, compile_fail, [''])
test('T16923', normal, compile_fail, [''])
+test('T18127b', normal, compile_fail, [''])
test('deriving-via-fail', normal, compile_fail, [''])
test('deriving-via-fail2', normal, compile_fail, [''])
test('deriving-via-fail3', normal, compile_fail, [''])