summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-03-07 16:45:55 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-03-07 16:51:37 +0000
commitcdac487bcd9928d77738f6e79ead7b9bb4bc00fd (patch)
tree76a3750754f317b81987e00a66c4ce188eecf181 /testsuite/tests
parent3efcb0a7d147e05f86501783144bcd0ad3757e93 (diff)
downloadhaskell-cdac487bcd9928d77738f6e79ead7b9bb4bc00fd.tar.gz
Make -XDeriveFunctor more generous about non-last arguments (Trac #8678)
When deriving Functor, Foldable, Traversable, we need only look at the way that the last type argument is treated. It's fine for there to be existentials etc, provided they don't affect the last type argument. See Note [Check that the type variable is truly universal] in TcDeriv.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/deriving/should_compile/T8678.hs12
-rw-r--r--testsuite/tests/deriving/should_compile/all.T3
-rw-r--r--testsuite/tests/deriving/should_fail/T3101.stderr2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_0.stderr3
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_0.stderr3
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail086.stderr2
6 files changed, 20 insertions, 5 deletions
diff --git a/testsuite/tests/deriving/should_compile/T8678.hs b/testsuite/tests/deriving/should_compile/T8678.hs
new file mode 100644
index 0000000000..655f530b5b
--- /dev/null
+++ b/testsuite/tests/deriving/should_compile/T8678.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE DataKinds, DeriveFunctor, FlexibleInstances, GADTs, KindSignatures, StandaloneDeriving #-}
+module T8678 where
+
+data {- kind -} Nat = Z | S Nat
+
+-- GADT in parameter other than the last
+data NonStandard :: Nat -> * -> * -> * where
+ Standard :: a -> NonStandard (S n) a b
+ Non :: NonStandard n a b -> b -> NonStandard (S n) a b
+
+deriving instance (Show a, Show b) => Show (NonStandard n a b)
+deriving instance Functor (NonStandard n a)
diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T
index 8620c36dc5..5d9c7337f1 100644
--- a/testsuite/tests/deriving/should_compile/all.T
+++ b/testsuite/tests/deriving/should_compile/all.T
@@ -44,4 +44,5 @@ test('AutoDeriveTypeable', normal, compile, [''])
test('T8138', reqlib('primitive'), compile, ['-O2'])
test('T8631', normal, compile, [''])
test('T8758', extra_clean(['T8758a.o', 'T8758a.hi']), multimod_compile, ['T8758a', '-v0'])
-test('T8851', expect_broken(8851), compile, ['']) \ No newline at end of file
+test('T8851', expect_broken(8851), compile, [''])
+test('T8678', normal, compile, [''])
diff --git a/testsuite/tests/deriving/should_fail/T3101.stderr b/testsuite/tests/deriving/should_fail/T3101.stderr
index 58069283dc..7c976178c4 100644
--- a/testsuite/tests/deriving/should_fail/T3101.stderr
+++ b/testsuite/tests/deriving/should_fail/T3101.stderr
@@ -1,6 +1,6 @@
T3101.hs:9:12:
Can't make a derived instance of ‘Show Boom’:
- Constructor ‘Boom’ must have a Haskell-98 type
+ Constructor ‘Boom’ has a higher-rank type
Possible fix: use a standalone deriving declaration instead
In the data declaration for ‘Boom’
diff --git a/testsuite/tests/generics/GenCannotDoRep0_0.stderr b/testsuite/tests/generics/GenCannotDoRep0_0.stderr
index 3537dac4d6..e1292b8e7e 100644
--- a/testsuite/tests/generics/GenCannotDoRep0_0.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep0_0.stderr
@@ -4,7 +4,8 @@ GenCannotDoRep0_0.hs:6:14: Warning:
GenCannotDoRep0_0.hs:13:45:
Can't make a derived instance of ‘Generic Dynamic’:
- Dynamic must be a vanilla data constructor
+ Constructor ‘Dynamic’ has existentials or constraints in its type
+ Possible fix: use a standalone deriving declaration instead
In the data declaration for ‘Dynamic’
GenCannotDoRep0_0.hs:17:1:
diff --git a/testsuite/tests/generics/GenCannotDoRep1_0.stderr b/testsuite/tests/generics/GenCannotDoRep1_0.stderr
index e40f359613..7764f24662 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_0.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep1_0.stderr
@@ -1,5 +1,6 @@
GenCannotDoRep1_0.hs:9:49:
Can't make a derived instance of ‘Generic1 Dynamic’:
- Dynamic must be a vanilla data constructor
+ Constructor ‘Dynamic’ has existentials or constraints in its type
+ Possible fix: use a standalone deriving declaration instead
In the data declaration for ‘Dynamic’
diff --git a/testsuite/tests/typecheck/should_fail/tcfail086.stderr b/testsuite/tests/typecheck/should_fail/tcfail086.stderr
index 65149ef1f9..f88fde164b 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail086.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail086.stderr
@@ -1,6 +1,6 @@
tcfail086.hs:6:38:
Can't make a derived instance of ‘Eq Ex’:
- Constructor ‘Ex’ must have a Haskell-98 type
+ Constructor ‘Ex’ has existentials or constraints in its type
Possible fix: use a standalone deriving declaration instead
In the data declaration for ‘Ex’