diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-02-05 19:57:29 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-02-05 19:57:29 -0500 |
commit | e88e083d62389d5c8d082a25395a3d933ab2f03b (patch) | |
tree | b155b8a313a244c834e15cba6a8b537ac5481717 /testsuite/tests/deriving | |
parent | ab4934230bb12451f8990d063906f24ab072addc (diff) | |
download | haskell-e88e083d62389d5c8d082a25395a3d933ab2f03b.tar.gz |
Fix #14579 by defining tyConAppNeedsKindSig, and using it
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r-- | testsuite/tests/deriving/should_compile/T14578.stderr | 30 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/T14579.stderr | 39 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/T14579b.hs | 21 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/all.T | 3 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_fail/T15073.stderr | 21 |
5 files changed, 79 insertions, 35 deletions
diff --git a/testsuite/tests/deriving/should_compile/T14578.stderr b/testsuite/tests/deriving/should_compile/T14578.stderr index 78861f69e0..0c0fb641f7 100644 --- a/testsuite/tests/deriving/should_compile/T14578.stderr +++ b/testsuite/tests/deriving/should_compile/T14578.stderr @@ -66,39 +66,29 @@ Derived class instances: GHC.Base.Semigroup (T14578.Wat f g a) where (GHC.Base.<>) = GHC.Prim.coerce - @(T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a - -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a - -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a) + @(T14578.App (Data.Functor.Compose.Compose f g) a + -> T14578.App (Data.Functor.Compose.Compose f g) a + -> T14578.App (Data.Functor.Compose.Compose f g) a) @(T14578.Wat f g a -> T14578.Wat f g a -> T14578.Wat f g a) ((GHC.Base.<>) - @(T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a)) :: + @(T14578.App (Data.Functor.Compose.Compose f g) a)) :: T14578.Wat f g a -> T14578.Wat f g a -> T14578.Wat f g a GHC.Base.sconcat = GHC.Prim.coerce - @(GHC.Base.NonEmpty (T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a) - -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a) + @(GHC.Base.NonEmpty (T14578.App (Data.Functor.Compose.Compose f g) a) + -> T14578.App (Data.Functor.Compose.Compose f g) a) @(GHC.Base.NonEmpty (T14578.Wat f g a) -> T14578.Wat f g a) (GHC.Base.sconcat - @(T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a)) :: + @(T14578.App (Data.Functor.Compose.Compose f g) a)) :: GHC.Base.NonEmpty (T14578.Wat f g a) -> T14578.Wat f g a GHC.Base.stimes = GHC.Prim.coerce @(b - -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a - -> T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a) + -> T14578.App (Data.Functor.Compose.Compose f g) a + -> T14578.App (Data.Functor.Compose.Compose f g) a) @(b -> T14578.Wat f g a -> T14578.Wat f g a) (GHC.Base.stimes - @(T14578.App (Data.Functor.Compose.Compose f g :: TYPE GHC.Types.LiftedRep - -> TYPE GHC.Types.LiftedRep) a)) :: + @(T14578.App (Data.Functor.Compose.Compose f g) a)) :: forall (b :: TYPE GHC.Types.LiftedRep). GHC.Real.Integral b => b -> T14578.Wat f g a -> T14578.Wat f g a diff --git a/testsuite/tests/deriving/should_compile/T14579.stderr b/testsuite/tests/deriving/should_compile/T14579.stderr new file mode 100644 index 0000000000..133ba6fb2f --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T14579.stderr @@ -0,0 +1,39 @@ + +==================== Derived instances ==================== +Derived class instances: + instance forall a (x :: Data.Proxy.Proxy a). + GHC.Classes.Eq a => + GHC.Classes.Eq (T14579.Wat x) where + (GHC.Classes.==) + = GHC.Prim.coerce + @(GHC.Maybe.Maybe a -> GHC.Maybe.Maybe a -> GHC.Types.Bool) + @(T14579.Wat @a x -> T14579.Wat @a x -> GHC.Types.Bool) + ((GHC.Classes.==) @(GHC.Maybe.Maybe a)) :: + T14579.Wat @a x -> T14579.Wat @a x -> GHC.Types.Bool + (GHC.Classes./=) + = GHC.Prim.coerce + @(GHC.Maybe.Maybe a -> GHC.Maybe.Maybe a -> GHC.Types.Bool) + @(T14579.Wat @a x -> T14579.Wat @a x -> GHC.Types.Bool) + ((GHC.Classes./=) @(GHC.Maybe.Maybe a)) :: + T14579.Wat @a x -> T14579.Wat @a x -> GHC.Types.Bool + + instance GHC.Classes.Eq a => GHC.Classes.Eq (T14579.Glurp a) where + (GHC.Classes.==) + = GHC.Prim.coerce + @(T14579.Wat @a (Data.Proxy.Proxy @a) + -> T14579.Wat @a (Data.Proxy.Proxy @a) -> GHC.Types.Bool) + @(T14579.Glurp a -> T14579.Glurp a -> GHC.Types.Bool) + ((GHC.Classes.==) @(T14579.Wat @a (Data.Proxy.Proxy @a))) :: + T14579.Glurp a -> T14579.Glurp a -> GHC.Types.Bool + (GHC.Classes./=) + = GHC.Prim.coerce + @(T14579.Wat @a (Data.Proxy.Proxy @a) + -> T14579.Wat @a (Data.Proxy.Proxy @a) -> GHC.Types.Bool) + @(T14579.Glurp a -> T14579.Glurp a -> GHC.Types.Bool) + ((GHC.Classes./=) @(T14579.Wat @a (Data.Proxy.Proxy @a))) :: + T14579.Glurp a -> T14579.Glurp a -> GHC.Types.Bool + + +Derived type family instances: + + diff --git a/testsuite/tests/deriving/should_compile/T14579b.hs b/testsuite/tests/deriving/should_compile/T14579b.hs new file mode 100644 index 0000000000..c73844a1db --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T14579b.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE PolyKinds #-} +module T14579b where + +import Data.Kind +import Data.Proxy + +-- type P :: forall {k} {t :: k}. Proxy t +type P = 'Proxy + +-- type Wat :: forall a. Proxy a -> * +newtype Wat (x :: Proxy (a :: Type)) = MkWat (Maybe a) + deriving Eq + +-- type Wat2 :: forall {a}. Proxy a -> * +type Wat2 = Wat + +-- type Glurp :: * -> * +newtype Glurp a = MkGlurp (Wat2 (P :: Proxy a)) + deriving Eq diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index 656cc0de4b..5aa102b871 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -103,8 +103,9 @@ test('T14094', normal, compile, ['']) test('T14339', normal, compile, ['']) test('T14331', normal, compile, ['']) test('T14578', normal, compile, ['-ddump-deriv -dsuppress-uniques']) -test('T14579', normal, compile, ['']) +test('T14579', normal, compile, ['-ddump-deriv -dsuppress-uniques']) test('T14579a', normal, compile, ['']) +test('T14579b', normal, compile, ['']) test('T14682', normal, compile, ['-ddump-deriv -dsuppress-uniques']) test('T14883', normal, compile, ['']) test('T14932', normal, compile, ['']) diff --git a/testsuite/tests/deriving/should_fail/T15073.stderr b/testsuite/tests/deriving/should_fail/T15073.stderr index 2cc3f90482..1235b01c68 100644 --- a/testsuite/tests/deriving/should_fail/T15073.stderr +++ b/testsuite/tests/deriving/should_fail/T15073.stderr @@ -3,26 +3,19 @@ T15073.hs:8:12: error: • Illegal unboxed tuple type as function argument: (# Foo a #) Perhaps you intended to use UnboxedTuples • In an expression type signature: - Foo a - -> (Unit# (Foo a) :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep))) + Foo a -> Unit# @GHC.Types.LiftedRep (Foo a) In the expression: GHC.Prim.coerce - @(a - -> (Unit# a :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) - @(Foo a - -> (Unit# (Foo a) :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) + @(a -> Unit# @GHC.Types.LiftedRep a) + @(Foo a -> Unit# @GHC.Types.LiftedRep (Foo a)) (p @a) :: - Foo a - -> (Unit# (Foo a) :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep))) + Foo a -> Unit# @GHC.Types.LiftedRep (Foo a) In an equation for ‘p’: p = GHC.Prim.coerce - @(a - -> (Unit# a :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) - @(Foo a - -> (Unit# (Foo a) :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep)))) + @(a -> Unit# @GHC.Types.LiftedRep a) + @(Foo a -> Unit# @GHC.Types.LiftedRep (Foo a)) (p @a) :: - Foo a - -> (Unit# (Foo a) :: TYPE (GHC.Types.TupleRep ((:) GHC.Types.LiftedRep ([] :: [] GHC.Types.RuntimeRep) :: [] GHC.Types.RuntimeRep))) + Foo a -> Unit# @GHC.Types.LiftedRep (Foo a) When typechecking the code for ‘p’ in a derived instance for ‘P (Foo a)’: To see the code I am typechecking, use -ddump-deriv |