From c7c1a73b6e93e505b06736cbb6f8be79fdca32c1 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Fri, 3 Mar 2023 08:21:22 +0000 Subject: Add test for T22793 --- testsuite/tests/polykinds/T22793.hs | 17 +++++++++++++ testsuite/tests/polykinds/T22793.stderr | 44 +++++++++++++++++++++++++++++++++ testsuite/tests/polykinds/all.T | 1 + 3 files changed, 62 insertions(+) create mode 100644 testsuite/tests/polykinds/T22793.hs create mode 100644 testsuite/tests/polykinds/T22793.stderr diff --git a/testsuite/tests/polykinds/T22793.hs b/testsuite/tests/polykinds/T22793.hs new file mode 100644 index 0000000000..3864748c49 --- /dev/null +++ b/testsuite/tests/polykinds/T22793.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE MultiParamTypeClasses #-} + +module T22793 where + +import Data.Kind + +type Foo :: forall k. k -> k -> Constraint + +class Foo s a + +bob :: forall {k1} {ks} {ka} q (p :: k1 -> q -> Type) + (f :: ka -> q) (s :: ks) (t :: ks) + (a :: ka) (b :: ka). Foo s a + => p a (f b) -> p s (f t) +bob f = undefined diff --git a/testsuite/tests/polykinds/T22793.stderr b/testsuite/tests/polykinds/T22793.stderr new file mode 100644 index 0000000000..8082fa5be0 --- /dev/null +++ b/testsuite/tests/polykinds/T22793.stderr @@ -0,0 +1,44 @@ + +T22793.hs:15:42: error: [GHC-25897] + • Couldn't match kind ‘ka’ with ‘k1’ + Expected kind ‘ks’, but ‘a’ has kind ‘ka’ + ‘ka’ is a rigid type variable bound by + the type signature for ‘bob’ + at T22793.hs:13:26-27 + ‘k1’ is a rigid type variable bound by + the type signature for ‘bob’ + at T22793.hs:13:16-17 + • In the second argument of ‘Foo’, namely ‘a’ + In the type signature: + bob :: forall {k1} + {ks} + {ka} + q + (p :: k1 -> q -> Type) + (f :: ka -> q) + (s :: ks) + (t :: ks) + (a :: ka) + (b :: ka). Foo s a => p a (f b) -> p s (f t) + +T22793.hs:16:11: error: [GHC-25897] + • Couldn't match kind ‘ks’ with ‘k1’ + Expected kind ‘k1’, but ‘a’ has kind ‘ka’ + ‘ks’ is a rigid type variable bound by + the type signature for ‘bob’ + at T22793.hs:13:21-22 + ‘k1’ is a rigid type variable bound by + the type signature for ‘bob’ + at T22793.hs:13:16-17 + • In the first argument of ‘p’, namely ‘a’ + In the type signature: + bob :: forall {k1} + {ks} + {ka} + q + (p :: k1 -> q -> Type) + (f :: ka -> q) + (s :: ks) + (t :: ks) + (a :: ka) + (b :: ka). Foo s a => p a (f b) -> p s (f t) diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index a73508858c..e16789136f 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -243,3 +243,4 @@ test('T22379a', normal, compile, ['']) test('T22379b', normal, compile, ['']) test('T22743', normal, compile_fail, ['']) test('T22742', normal, compile_fail, ['']) +test('T22793', normal, compile_fail, ['']) -- cgit v1.2.1