summaryrefslogtreecommitdiff
path: root/testsuite/tests/generics
diff options
context:
space:
mode:
authorNicolas Frisby <nicolas.frisby@gmail.com>2013-11-10 00:06:27 -0600
committerJose Pedro Magalhaes <jpm@cs.ox.ac.uk>2013-11-18 16:29:24 +0000
commit3b55ede1ed4cee59c083ca3132c75f90491b3f1f (patch)
tree7f58fa07322a745db061ecb8645bcd24f95365cf /testsuite/tests/generics
parent8d2617a2c3fae723453c9b38c4d3b56d0229dc4b (diff)
downloadhaskell-3b55ede1ed4cee59c083ca3132c75f90491b3f1f.tar.gz
Update output for generics
Diffstat (limited to 'testsuite/tests/generics')
-rw-r--r--testsuite/tests/generics/GenCanDoRep0.hs17
-rw-r--r--testsuite/tests/generics/GenCanDoRep1.hs25
-rw-r--r--testsuite/tests/generics/GenCanDoRep1_0.hs32
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_0.hs (renamed from testsuite/tests/generics/GenCannotDoRep0.hs)2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_0.stderr (renamed from testsuite/tests/generics/GenCannotDoRep0.stderr)10
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_1.hs (renamed from testsuite/tests/generics/GenCannotDoRep1.hs)2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_1.stderr (renamed from testsuite/tests/generics/GenCannotDoRep1.stderr)4
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_2.hs (renamed from testsuite/tests/generics/GenCannotDoRep2.hs)2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep0_2.stderr (renamed from testsuite/tests/generics/GenCannotDoRep2.stderr)2
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_3.stderr3
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_4.stderr3
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_5.hs9
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_5.stderr5
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_6.stderr3
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_7.hs8
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_7.stderr9
-rw-r--r--testsuite/tests/generics/GenCannotDoRep1_8.stderr3
-rw-r--r--testsuite/tests/generics/T8468.hs7
-rw-r--r--testsuite/tests/generics/T8468.stderr5
-rw-r--r--testsuite/tests/generics/T8479.hs12
-rw-r--r--testsuite/tests/generics/all.T22
21 files changed, 86 insertions, 99 deletions
diff --git a/testsuite/tests/generics/GenCanDoRep0.hs b/testsuite/tests/generics/GenCanDoRep0.hs
index 8a0b4e07d6..df18595edc 100644
--- a/testsuite/tests/generics/GenCanDoRep0.hs
+++ b/testsuite/tests/generics/GenCanDoRep0.hs
@@ -8,20 +8,15 @@ import GHC.Generics (Generic)
-- We should be able to generate a generic representation for these types
-data A
- deriving Generic
+data A deriving Generic
-data B a
- deriving Generic
+data B a deriving Generic
-data C = C0 | C1
- deriving Generic
+data C = C0 | C1 deriving Generic
-data D a = D0 | D1 { d11 :: a, d12 :: (D a) }
- deriving Generic
+data D a = D0 | D1 { d11 :: a, d12 :: (D a) } deriving Generic
-data (:*:) a b = a :*: b
- deriving Generic
+data (:*:) a b = a :*: b deriving Generic
data family F a
-data instance F Int = FInt deriving Generic
+data instance F Int = FInt deriving Generic
diff --git a/testsuite/tests/generics/GenCanDoRep1.hs b/testsuite/tests/generics/GenCanDoRep1.hs
index 93817e6c54..1ddb39aee1 100644
--- a/testsuite/tests/generics/GenCanDoRep1.hs
+++ b/testsuite/tests/generics/GenCanDoRep1.hs
@@ -7,18 +7,27 @@ import GHC.Generics (Generic, Generic1)
-- We should be able to generate a generic representation for these types
-data A a
- deriving Generic1
+data A a deriving Generic1
-data B a = B0 | B1
- deriving Generic1
+data B a = B0 | B1 deriving Generic1
data C a = C0 | C1 { c11 :: a, c12 :: (C a) }
deriving (Generic, Generic1)
-data D a = D (Either Int a) deriving Generic1
+data D a = D (Either Int a) deriving Generic1
-data E a = E (Either Int (E a)) deriving Generic1
+data E a = E (Either Int (E a)) deriving Generic1
-data (:*:) a b = a :*: b
- deriving (Generic, Generic1)
+data F c b a = F (c, b, a) deriving Generic1
+data G c b a = G [(c, c, c, c, b, a)] deriving (Generic1, Show)
+
+
+data Odd a = Odd a (Even a) deriving Generic1
+data Even a = NilEven | Even a (Odd a) deriving Generic1
+
+data Odd' a = Odd' a (Even' a) deriving Generic1
+data Even' a = NilEven' | Even' a (Odd' a)
+
+data H b a = H0 | H1 (H b b) deriving Generic1
+
+data (:*:) a b = a :*: b deriving (Generic, Generic1)
diff --git a/testsuite/tests/generics/GenCanDoRep1_0.hs b/testsuite/tests/generics/GenCanDoRep1_0.hs
deleted file mode 100644
index db557d871b..0000000000
--- a/testsuite/tests/generics/GenCanDoRep1_0.hs
+++ /dev/null
@@ -1,32 +0,0 @@
-{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE TypeOperators #-}
-
-module GenCanDoRep1_0 where
-
-import GHC.Generics (Generic1(..), Rep1)
-
-
--- We should be able to generate a generic representation for these types
-data B a
- deriving Generic1
-
-data C a = C0 | C1
- deriving Generic1
-
-data D a = D0 | D1 { d11 :: a, d12 :: (D a) }
- deriving Generic1
-
-data (:*:) a b = a :*: b
- deriving Generic1
-
-data E b a = E0 | E1 (E b b) deriving Generic1
-
-data F c b a = F (c, b, a) deriving Generic1
-data G c b a = G [(c, c, c, c, b, a)] deriving (Generic1, Show)
-
-
-data Odd a = Odd a (Even a) deriving Generic1
-data Even a = NilEven | Even a (Odd a) deriving Generic1
-
-data Odd' a = Odd' a (Even' a) deriving Generic1
-data Even' a = NilEven' | Even' a (Odd' a)
diff --git a/testsuite/tests/generics/GenCannotDoRep0.hs b/testsuite/tests/generics/GenCannotDoRep0_0.hs
index 21beb8ae02..10d4dbfb7b 100644
--- a/testsuite/tests/generics/GenCannotDoRep0.hs
+++ b/testsuite/tests/generics/GenCannotDoRep0_0.hs
@@ -5,7 +5,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DatatypeContexts #-}
-module CannotDoRep0 where
+module CannotDoRep0_0 where
import GHC.Generics hiding (P, D)
diff --git a/testsuite/tests/generics/GenCannotDoRep0.stderr b/testsuite/tests/generics/GenCannotDoRep0_0.stderr
index d216a703b3..ae1cdc7bec 100644
--- a/testsuite/tests/generics/GenCannotDoRep0.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep0_0.stderr
@@ -1,23 +1,23 @@
-GenCannotDoRep0.hs:6:14: Warning:
+GenCannotDoRep0_0.hs:6:14: Warning:
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
-GenCannotDoRep0.hs:13:45:
+GenCannotDoRep0_0.hs:13:45:
Can't make a derived instance of ‛Generic Dynamic’:
Dynamic must be a vanilla data constructor
In the data declaration for ‛Dynamic’
-GenCannotDoRep0.hs:17:1:
+GenCannotDoRep0_0.hs:17:1:
Can't make a derived instance of ‛Generic (P Int)’:
P must not be instantiated; try deriving `P a' instead
In the stand-alone deriving instance for ‛Generic (P Int)’
-GenCannotDoRep0.hs:26:1:
+GenCannotDoRep0_0.hs:26:1:
Can't make a derived instance of ‛Generic (D Char Char)’:
D must not be instantiated; try deriving `D Char b' instead
In the stand-alone deriving instance for ‛Generic (D Char Char)’
-GenCannotDoRep0.hs:28:1:
+GenCannotDoRep0_0.hs:28:1:
Can't make a derived instance of ‛Generic (D Int a)’:
D must not have a datatype context
In the stand-alone deriving instance for ‛Generic (D Int a)’
diff --git a/testsuite/tests/generics/GenCannotDoRep1.hs b/testsuite/tests/generics/GenCannotDoRep0_1.hs
index 98ad108dbf..23a2bdd17d 100644
--- a/testsuite/tests/generics/GenCannotDoRep1.hs
+++ b/testsuite/tests/generics/GenCannotDoRep0_1.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE DeriveGeneric, DatatypeContexts #-}
-module CannotDoRep1 where
+module CannotDoRep0_1 where
import GHC.Generics
diff --git a/testsuite/tests/generics/GenCannotDoRep1.stderr b/testsuite/tests/generics/GenCannotDoRep0_1.stderr
index 7e0f124b1e..280885f1a4 100644
--- a/testsuite/tests/generics/GenCannotDoRep1.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep0_1.stderr
@@ -1,8 +1,8 @@
-GenCannotDoRep1.hs:1:29: Warning:
+GenCannotDoRep0_1.hs:1:29: Warning:
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
-GenCannotDoRep1.hs:8:49:
+GenCannotDoRep0_1.hs:8:49:
Can't make a derived instance of ‛Generic (Context a)’:
Context must not have a datatype context
In the data declaration for ‛Context’
diff --git a/testsuite/tests/generics/GenCannotDoRep2.hs b/testsuite/tests/generics/GenCannotDoRep0_2.hs
index ad816f4ce4..ed1a06f80b 100644
--- a/testsuite/tests/generics/GenCannotDoRep2.hs
+++ b/testsuite/tests/generics/GenCannotDoRep0_2.hs
@@ -2,7 +2,7 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GADTs #-}
-module CannotDoRep2 where
+module CannotDoRep0_2 where
import GHC.Generics
diff --git a/testsuite/tests/generics/GenCannotDoRep2.stderr b/testsuite/tests/generics/GenCannotDoRep0_2.stderr
index 635102310a..6dad193f4b 100644
--- a/testsuite/tests/generics/GenCannotDoRep2.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep0_2.stderr
@@ -1,5 +1,5 @@
-GenCannotDoRep2.hs:13:1:
+GenCannotDoRep0_2.hs:13:1:
Can't make a derived instance of ‛Generic (Term a)’:
Int must be a vanilla data constructor
In the stand-alone deriving instance for ‛Generic (Term a)’
diff --git a/testsuite/tests/generics/GenCannotDoRep1_3.stderr b/testsuite/tests/generics/GenCannotDoRep1_3.stderr
index 7e54463ff5..eb70075920 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_3.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep1_3.stderr
@@ -1,5 +1,6 @@
GenCannotDoRep1_3.hs:11:33:
Can't make a derived instance of ‛Generic1 T’:
- Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
+ Constructor ‛T’ applies a type to an argument involving the last parameter
+ but the applied type is not of kind * -> *
In the data declaration for ‛T’
diff --git a/testsuite/tests/generics/GenCannotDoRep1_4.stderr b/testsuite/tests/generics/GenCannotDoRep1_4.stderr
index e4b39838d6..898134c117 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_4.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep1_4.stderr
@@ -1,5 +1,6 @@
GenCannotDoRep1_4.hs:8:34:
Can't make a derived instance of ‛Generic1 T’:
- Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
+ Constructor ‛T’ applies a type to an argument involving the last parameter
+ but the applied type is not of kind * -> *
In the data declaration for ‛T’
diff --git a/testsuite/tests/generics/GenCannotDoRep1_5.hs b/testsuite/tests/generics/GenCannotDoRep1_5.hs
deleted file mode 100644
index a34c093e2a..0000000000
--- a/testsuite/tests/generics/GenCannotDoRep1_5.hs
+++ /dev/null
@@ -1,9 +0,0 @@
-{-# LANGUAGE DeriveGeneric #-}
-
-module GenCannotDoRep1_5 where
-
-import GHC.Generics
-
--- We do not support occurrences of the type variable except as the last
--- argument
-data T a = T (a, Int) deriving Generic1
diff --git a/testsuite/tests/generics/GenCannotDoRep1_5.stderr b/testsuite/tests/generics/GenCannotDoRep1_5.stderr
deleted file mode 100644
index 21e849098c..0000000000
--- a/testsuite/tests/generics/GenCannotDoRep1_5.stderr
+++ /dev/null
@@ -1,5 +0,0 @@
-
-GenCannotDoRep1_5.hs:9:32:
- Can't make a derived instance of ‛Generic1 T’:
- Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
- In the data declaration for ‛T’
diff --git a/testsuite/tests/generics/GenCannotDoRep1_6.stderr b/testsuite/tests/generics/GenCannotDoRep1_6.stderr
index 06d95b223e..be5d96ada6 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_6.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep1_6.stderr
@@ -1,5 +1,6 @@
GenCannotDoRep1_6.hs:9:43:
Can't make a derived instance of ‛Generic1 T’:
- Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
+ Constructor ‛T’ applies a type to an argument involving the last parameter
+ but the applied type is not of kind * -> *
In the data declaration for ‛T’
diff --git a/testsuite/tests/generics/GenCannotDoRep1_7.hs b/testsuite/tests/generics/GenCannotDoRep1_7.hs
index c97f0611e8..a229c90ed7 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_7.hs
+++ b/testsuite/tests/generics/GenCannotDoRep1_7.hs
@@ -4,8 +4,6 @@ module GenCannotDoRep1_7 where
import GHC.Generics
--- We do not support contravariant occurrences of the type variable
-data B a = B (a -> Int)
-
--- so this fails because B is not representable
-data T a = T (B a) deriving Generic1
+-- We do not support occurrences of the type variable except as the last
+-- argument
+data I a = I (a, Int) deriving Generic1
diff --git a/testsuite/tests/generics/GenCannotDoRep1_7.stderr b/testsuite/tests/generics/GenCannotDoRep1_7.stderr
index 2830a6d774..34302ca483 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_7.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep1_7.stderr
@@ -1,5 +1,6 @@
-GenCannotDoRep1_7.hs:11:29:
- Can't make a derived instance of ‛Generic1 T’:
- must not apply type constructors that cannot be represented with `Rep1' (such as `B') to arguments that involve the last type parameter
- In the data declaration for ‛T’
+GenCannotDoRep1_7.hs:9:32:
+ Can't make a derived instance of ‛Generic1 I’:
+ Constructor ‛I’ applies a type to an argument involving the last parameter
+ but the applied type is not of kind * -> *
+ In the data declaration for ‛I’
diff --git a/testsuite/tests/generics/GenCannotDoRep1_8.stderr b/testsuite/tests/generics/GenCannotDoRep1_8.stderr
index 305944471f..d42fbe08b7 100644
--- a/testsuite/tests/generics/GenCannotDoRep1_8.stderr
+++ b/testsuite/tests/generics/GenCannotDoRep1_8.stderr
@@ -1,5 +1,6 @@
GenCannotDoRep1_8.hs:12:30:
Can't make a derived instance of ‛Generic1 T’:
- Constructor ‛T’ must use the last type parameter only as the last argument of a data type, newtype, or (->)
+ Constructor ‛T’ applies a type to an argument involving the last parameter
+ but the applied type is not of kind * -> *
In the data declaration for ‛T’
diff --git a/testsuite/tests/generics/T8468.hs b/testsuite/tests/generics/T8468.hs
new file mode 100644
index 0000000000..f76be9f951
--- /dev/null
+++ b/testsuite/tests/generics/T8468.hs
@@ -0,0 +1,7 @@
+{-# Language DeriveGeneric, MagicHash #-}
+
+import GHC.Generics
+import GHC.Prim
+
+data Array a = Array (Array# a) deriving Generic1
+newtype Vec a = MkVec {unVec :: Array a} deriving Generic1
diff --git a/testsuite/tests/generics/T8468.stderr b/testsuite/tests/generics/T8468.stderr
new file mode 100644
index 0000000000..e95c51d3ec
--- /dev/null
+++ b/testsuite/tests/generics/T8468.stderr
@@ -0,0 +1,5 @@
+
+T8468.hs:6:42:
+ Can't make a derived instance of ‛Generic1 Array’:
+ Array must not have unlifted or polymorphic arguments
+ In the data declaration for ‛Array’
diff --git a/testsuite/tests/generics/T8479.hs b/testsuite/tests/generics/T8479.hs
new file mode 100644
index 0000000000..77c95f5449
--- /dev/null
+++ b/testsuite/tests/generics/T8479.hs
@@ -0,0 +1,12 @@
+{-# OPTIONS_GHC -Wall #-}
+{-# Language TypeFamilies #-}
+{-# Language DeriveGeneric #-}
+
+module T8479 where
+
+import GHC.Generics
+
+class Blah (a :: * -> *) where
+ type F a :: * -> *
+
+data Foo (f :: * -> *) a = MkFoo ((F f) a) deriving Generic1
diff --git a/testsuite/tests/generics/all.T b/testsuite/tests/generics/all.T
index 267fbe6dcf..1231c61b34 100644
--- a/testsuite/tests/generics/all.T
+++ b/testsuite/tests/generics/all.T
@@ -5,15 +5,9 @@ test('GenCanDoRep1', normal, compile, [''])
test('GenDerivOutput', normal, compile, ['-dsuppress-uniques'])
test('GenShouldFail0', normal, compile_fail, [''])
-test('GenCannotDoRep0', normal, compile_fail, [''])
-test('GenCannotDoRep1', normal, compile_fail, [''])
-test('GenCannotDoRep2', normal, compile_fail, [''])
-test('T5884', normal, compile, [''])
-test('GenNewtype', normal, compile_and_run, [''])
-
-test('GenCanDoRep1_0', normal, compile, [''])
-test('GenDerivOutput1_0', normal, compile, ['-dsuppress-uniques'])
-test('GenDerivOutput1_1', normal, compile, ['-dsuppress-uniques'])
+test('GenCannotDoRep0_0', normal, compile_fail, [''])
+test('GenCannotDoRep0_1', normal, compile_fail, [''])
+test('GenCannotDoRep0_2', normal, compile_fail, [''])
test('GenShouldFail1_0', normal, compile_fail, [''])
test('GenCannotDoRep1_0', normal, compile_fail, [''])
@@ -21,12 +15,20 @@ test('GenCannotDoRep1_1', normal, compile_fail, [''])
test('GenCannotDoRep1_2', normal, compile_fail, [''])
test('GenCannotDoRep1_3', normal, compile_fail, [''])
test('GenCannotDoRep1_4', normal, compile_fail, [''])
-test('GenCannotDoRep1_5', normal, compile_fail, [''])
test('GenCannotDoRep1_6', normal, compile_fail, [''])
test('GenCannotDoRep1_7', normal, compile_fail, [''])
test('GenCannotDoRep1_8', normal, compile_fail, [''])
+test('T5884', normal, compile, [''])
+test('GenNewtype', normal, compile_and_run, [''])
+
+test('GenDerivOutput1_0', normal, compile, ['-dsuppress-uniques'])
+test('GenDerivOutput1_1', normal, compile, ['-dsuppress-uniques'])
+
test('T7878', extra_clean(['T7878A.o' ,'T7878A.hi'
,'T7878A.o-boot','T7878A.hi-boot'
,'T7878B.o' ,'T7878B.hi']),
multimod_compile, ['T7878', '-v0'])
+
+test('T8468', normal, compile_fail, [''])
+test('T8479', normal, compile, [''])