From 6f8e1791a10899408483c148cac74f4aae339cae Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Thu, 8 Apr 2021 15:26:01 +0100 Subject: Add regression test for T19615 Fixes #19615 --- testsuite/tests/typecheck/should_fail/T19615.hs | 17 +++++++++++++++++ testsuite/tests/typecheck/should_fail/T19615.stderr | 6 ++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 3 files changed, 24 insertions(+) create mode 100644 testsuite/tests/typecheck/should_fail/T19615.hs create mode 100644 testsuite/tests/typecheck/should_fail/T19615.stderr 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, ['']) -- cgit v1.2.1