diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-05-06 09:49:45 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-07 20:07:19 -0400 |
commit | a32eb0f3d5037b0c6fefa38ec19ff8c22076d102 (patch) | |
tree | 79a0288f27a22c46d4ea2d6c0cfabc28c13a185e /testsuite/tests/polykinds | |
parent | 39be32839e4622c6df2f0544f2ad6fc9ed51c81c (diff) | |
download | haskell-a32eb0f3d5037b0c6fefa38ec19ff8c22076d102.tar.gz |
Fix newtype eta-reduction
The eta-reduction we do for newype axioms was generating
an inhomogeneous axiom: see #19739.
This patch fixes it in a simple way; see GHC.Tc.TyCl.Build
Note [Newtype eta and homogeneous axioms]
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r-- | testsuite/tests/polykinds/T19739a.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T19739b.hs | 10 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T19739c.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T19739d.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/polykinds/all.T | 4 |
5 files changed, 48 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T19739a.hs b/testsuite/tests/polykinds/T19739a.hs new file mode 100644 index 0000000000..55296b3197 --- /dev/null +++ b/testsuite/tests/polykinds/T19739a.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneKindSignatures #-} +module Bug where + +import Data.Kind +import Data.Proxy + +type T :: forall (a :: Type) -> Constraint +class T a where + f :: Proxy a diff --git a/testsuite/tests/polykinds/T19739b.hs b/testsuite/tests/polykinds/T19739b.hs new file mode 100644 index 0000000000..e0377383da --- /dev/null +++ b/testsuite/tests/polykinds/T19739b.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneKindSignatures #-} +module Bug where + +import Data.Kind +import Data.Proxy + +type T :: forall (a :: Type) -> Type +newtype T a = Mk (Proxy a) diff --git a/testsuite/tests/polykinds/T19739c.hs b/testsuite/tests/polykinds/T19739c.hs new file mode 100644 index 0000000000..331d1f74fd --- /dev/null +++ b/testsuite/tests/polykinds/T19739c.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneKindSignatures #-} +module Bug where + +import Data.Kind +import Data.Proxy + +type T :: (forall (x :: Type) -> x) -> forall (a :: Type) -> Type +newtype T f a = MkT (f (Type -> Type) a) diff --git a/testsuite/tests/polykinds/T19739d.hs b/testsuite/tests/polykinds/T19739d.hs new file mode 100644 index 0000000000..e316abf620 --- /dev/null +++ b/testsuite/tests/polykinds/T19739d.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeFamilies #-} +module Foo where + +import Data.Kind +import Data.Proxy + +type F :: Type -> forall (a :: Type) -> Type +data family F a b +newtype instance F Int b = MkF (Proxy b) diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 581b065fa9..275281f527 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -236,3 +236,7 @@ test('T19093', normal, compile, ['']) test('T19094', normal, compile, ['']) test('T19250', normal, compile, ['']) test('T19522', normal, compile, ['']) +test('T19739a', normal, compile, ['']) +test('T19739b', normal, compile, ['']) +test('T19739c', normal, compile, ['']) +test('T19739d', normal, compile, ['']) |