summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-04-08 15:26:01 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-12 13:51:58 -0400
commit89ff12304f97a7a39fa07cffe69255df7fc8cc97 (patch)
treed778fe867511c5c2f26946c7f1361d8acda00284
parent18cbff86ec0cd3d06e99e3a00753cd66153210b5 (diff)
downloadhaskell-89ff12304f97a7a39fa07cffe69255df7fc8cc97.tar.gz
Add regression test for T19615
Fixes #19615
-rw-r--r--testsuite/tests/typecheck/should_fail/T19615.hs17
-rw-r--r--testsuite/tests/typecheck/should_fail/T19615.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
3 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T19615.hs b/testsuite/tests/typecheck/should_fail/T19615.hs
new file mode 100644
index 0000000000..8d71ca925e
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T19615.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+module T19615 where
+
+import GHC.Exts
+
+class Call (r :: RuntimeRep) where
+ type Lev (a :: TYPE r)
+ lift' :: (a :: TYPE r) -> (Lev a -> b) -> b
+ mapF :: forall r' (a :: TYPE r) (b :: TYPE r'). Call r' => (a -> b) -> Lev a -> Lev b
+
+instance Call LiftedRep where
+ type Lev a = a
+ lift' a k = k a
+ mapF f x = lift' (f x) id
diff --git a/testsuite/tests/typecheck/should_fail/T19615.stderr b/testsuite/tests/typecheck/should_fail/T19615.stderr
new file mode 100644
index 0000000000..b2e4f40231
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T19615.stderr
@@ -0,0 +1,6 @@
+
+T19615.hs:17:20: error:
+ A levity-polymorphic type is not allowed here:
+ Type: b
+ Kind: TYPE r'
+ In the type of expression: (f x)
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index d875b75909..7891e4543c 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -627,3 +627,4 @@ test('T19397E3', extra_files(['T19397S.hs']), multimod_compile_fail,
test('T19397E4', extra_files(['T19397S.hs']), multimod_compile_fail,
['T19397E4.hs', '-v0 -main-is foo'])
test('T19415', normal, compile_fail, [''])
+test('T19615', normal, compile_fail, [''])