From d4605e7ce4f5f8252a1e932e239cab79219875a5 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Thu, 11 Mar 2021 16:27:26 +0000 Subject: Fix an levity-polymorphism error As #19522 points out, we did not account for visible type application when trying to reject naked levity-polymorphic functions that have no binding. This patch tidies up the code, and fixes the bug too. --- testsuite/tests/polykinds/T19522.hs | 11 +++++++++++ testsuite/tests/polykinds/all.T | 1 + 2 files changed, 12 insertions(+) create mode 100644 testsuite/tests/polykinds/T19522.hs (limited to 'testsuite') diff --git a/testsuite/tests/polykinds/T19522.hs b/testsuite/tests/polykinds/T19522.hs new file mode 100644 index 0000000000..d7a7677a95 --- /dev/null +++ b/testsuite/tests/polykinds/T19522.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE TypeApplications #-} +module Bug where + +import GHC.Exts +import Unsafe.Coerce + +f :: Int -> Int +f x = unsafeCoerce# @LiftedRep @LiftedRep @Int @Int x + diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 1be9bb11b5..581b065fa9 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -235,3 +235,4 @@ test('T19092', normal, compile, ['']) test('T19093', normal, compile, ['']) test('T19094', normal, compile, ['']) test('T19250', normal, compile, ['']) +test('T19522', normal, compile, ['']) -- cgit v1.2.1