summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/polykinds/T21530a.hs9
-rw-r--r--testsuite/tests/polykinds/T21530a.stderr8
-rw-r--r--testsuite/tests/polykinds/T21530b.hs14
-rw-r--r--testsuite/tests/polykinds/T21530b.stderr11
-rw-r--r--testsuite/tests/polykinds/all.T2
5 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T21530a.hs b/testsuite/tests/polykinds/T21530a.hs
new file mode 100644
index 0000000000..e33381fbfd
--- /dev/null
+++ b/testsuite/tests/polykinds/T21530a.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE RankNTypes #-}
+
+module T21530 where
+
+f :: (forall a. (Show a, Eq a) => a -> String) -> String
+f h = h True
+
+g :: (forall a. Show a => a -> String) -> String
+g = f
diff --git a/testsuite/tests/polykinds/T21530a.stderr b/testsuite/tests/polykinds/T21530a.stderr
new file mode 100644
index 0000000000..4d504ef901
--- /dev/null
+++ b/testsuite/tests/polykinds/T21530a.stderr
@@ -0,0 +1,8 @@
+
+T21530a.hs:9:5: error:
+ • Couldn't match type: Eq a => a -> String
+ with: a -> String
+ Expected: (forall a. Show a => a -> String) -> String
+ Actual: (forall a. (Show a, Eq a) => a -> String) -> String
+ • In the expression: f
+ In an equation for ‘g’: g = f
diff --git a/testsuite/tests/polykinds/T21530b.hs b/testsuite/tests/polykinds/T21530b.hs
new file mode 100644
index 0000000000..e0afe1b873
--- /dev/null
+++ b/testsuite/tests/polykinds/T21530b.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE TypeApplications #-}
+
+module Foo where
+
+import Data.Kind
+import Data.Proxy
+
+f :: forall (a :: Type). Proxy a -> Int
+f = f
+
+g :: Proxy (Eq Int)
+g = g
+
+h = f g
diff --git a/testsuite/tests/polykinds/T21530b.stderr b/testsuite/tests/polykinds/T21530b.stderr
new file mode 100644
index 0000000000..552d9f915d
--- /dev/null
+++ b/testsuite/tests/polykinds/T21530b.stderr
@@ -0,0 +1,11 @@
+
+T21530b.hs:14:7: error:
+ • Couldn't match kind ‘Constraint’ with ‘*’
+ When matching types
+ a0 :: *
+ Eq Int :: Constraint
+ Expected: Proxy a0
+ Actual: Proxy (Eq Int)
+ • In the first argument of ‘f’, namely ‘g’
+ In the expression: f g
+ In an equation for ‘h’: h = f g
diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T
index 459ba1350d..0cba0b4c1f 100644
--- a/testsuite/tests/polykinds/all.T
+++ b/testsuite/tests/polykinds/all.T
@@ -239,3 +239,5 @@ test('T19739a', normal, compile, [''])
test('T19739b', normal, compile, [''])
test('T19739c', normal, compile, [''])
test('T19739d', normal, compile, [''])
+test('T21530a', normal, compile_fail, [''])
+test('T21530b', normal, compile_fail, [''])