diff options
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r-- | testsuite/tests/codeGen/should_compile/T13233.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_fail/T13233.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_fail/T13233.stderr | 28 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_fail/T13233_elab.stderr | 24 |
4 files changed, 27 insertions, 44 deletions
diff --git a/testsuite/tests/codeGen/should_compile/T13233.hs b/testsuite/tests/codeGen/should_compile/T13233.hs new file mode 100644 index 0000000000..bb79856d3b --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T13233.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE UnboxedTuples #-} +module Bug where + +import GHC.Exts (TYPE) + +class Foo (a :: TYPE rep) where + bar :: forall (b :: TYPE rep2). (a -> a -> b) -> a -> a -> b + +baz :: forall (a :: TYPE rep). Foo a => a -> a -> (# a, a #) +baz = bar (#,#) diff --git a/testsuite/tests/codeGen/should_fail/T13233.hs b/testsuite/tests/codeGen/should_fail/T13233.hs index f24fc03bfb..42a30522f2 100644 --- a/testsuite/tests/codeGen/should_fail/T13233.hs +++ b/testsuite/tests/codeGen/should_fail/T13233.hs @@ -3,19 +3,20 @@ {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE MagicHash #-} +{-# LANGUAGE LinearTypes #-} module Bug where import GHC.Exts (TYPE, RuntimeRep, Weak#, State#, RealWorld, mkWeak# ) class Foo (a :: TYPE rep) where - bar :: forall rep2 (b :: TYPE rep2). (a -> a -> b) -> a -> a -> b + bar :: forall rep2 (b :: TYPE rep2). (a #-> a #-> b) -> a #-> a #-> b -baz :: forall rep (a :: TYPE rep). Foo a => a -> a -> (# a, a #) +baz :: forall rep (a :: TYPE rep). Foo a => a #-> a #-> (# a, a #) baz = bar (#,#) obscure :: (forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep) (a :: TYPE rep1) (b :: TYPE rep2). - a -> b -> (# a, b #)) -> () + a #-> b #-> (# a, b #)) -> () obscure _ = () quux :: () diff --git a/testsuite/tests/codeGen/should_fail/T13233.stderr b/testsuite/tests/codeGen/should_fail/T13233.stderr index f6254778c1..1bbe161967 100644 --- a/testsuite/tests/codeGen/should_fail/T13233.stderr +++ b/testsuite/tests/codeGen/should_fail/T13233.stderr @@ -1,27 +1,11 @@ -T13233.hs:14:11: error: - Cannot use function with levity-polymorphic arguments: - (#,#) :: a -> a -> (# a, a #) - (Note that levity-polymorphic primops such as 'coerce' and unboxed tuples - are eta-expanded internally because they must occur fully saturated. - Use -fprint-typechecker-elaboration to display the full expression.) - Levity-polymorphic arguments: - a :: TYPE rep - a :: TYPE rep - -T13233.hs:22:16: error: - Cannot use function with levity-polymorphic arguments: - (#,#) :: forall {rep1 :: RuntimeRep} {rep2 :: RuntimeRep} - {a :: TYPE rep1} {b :: TYPE rep2}. - a -> b -> (# a, b #) - (Note that levity-polymorphic primops such as 'coerce' and unboxed tuples - are eta-expanded internally because they must occur fully saturated. - Use -fprint-typechecker-elaboration to display the full expression.) - Levity-polymorphic arguments: - a :: TYPE rep1 - b :: TYPE rep2 +T13233.hs:23:16: error: + A levity-polymorphic type is not allowed here: + Type: a + Kind: TYPE rep1 + When trying to create a variable of type: a -T13233.hs:27:10: error: +T13233.hs:28:10: error: Cannot use function with levity-polymorphic arguments: mkWeak# :: a -> b diff --git a/testsuite/tests/codeGen/should_fail/T13233_elab.stderr b/testsuite/tests/codeGen/should_fail/T13233_elab.stderr index 40a12ecd62..6a069752f7 100644 --- a/testsuite/tests/codeGen/should_fail/T13233_elab.stderr +++ b/testsuite/tests/codeGen/should_fail/T13233_elab.stderr @@ -1,25 +1,11 @@ -T13233_elab.hs:17:11: error: - Cannot use function with levity-polymorphic arguments: - (#,#) @rep @rep @a @a :: a -> a -> (# a, a #) - Levity-polymorphic arguments: - a :: TYPE rep - a :: TYPE rep - T13233_elab.hs:25:16: error: - Cannot use function with levity-polymorphic arguments: - /\(@(rep1 :: RuntimeRep)). - /\(@(rep2 :: RuntimeRep)). - /\(@(a :: TYPE rep1)). - /\(@(b :: TYPE rep2)). - (#,#) @rep1 @rep2 @a @b :: forall {rep1 :: RuntimeRep} - {rep2 :: RuntimeRep} {a :: TYPE rep1} {b :: TYPE rep2}. - a -> b -> (# a, b #) - Levity-polymorphic arguments: - a :: TYPE rep1 - b :: TYPE rep2 + A levity-polymorphic type is not allowed here: + Type: a + Kind: TYPE rep1 + When trying to create a variable of type: a -T13233_elab.hs:33:10: +T13233_elab.hs:33:10: error: Cannot use function with levity-polymorphic arguments: mkWeak# @rep @a @b @c :: a -> b |