diff options
Diffstat (limited to 'testsuite/tests/rep-poly')
44 files changed, 354 insertions, 213 deletions
diff --git a/testsuite/tests/rep-poly/Makefile b/testsuite/tests/rep-poly/Makefile new file mode 100644 index 0000000000..9a36a1c5fe --- /dev/null +++ b/testsuite/tests/rep-poly/Makefile @@ -0,0 +1,3 @@ +TOP=../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk diff --git a/testsuite/tests/rep-poly/RepPolyApp.stderr b/testsuite/tests/rep-poly/RepPolyApp.stderr index e823c04dc2..77dd0a30cf 100644 --- a/testsuite/tests/rep-poly/RepPolyApp.stderr +++ b/testsuite/tests/rep-poly/RepPolyApp.stderr @@ -1,10 +1,8 @@ -RepPolyApp.hs:11:11: error: - • The function argument - ‘(undefined :: a)’ +RepPolyApp.hs:11:9: error: + • The argument ‘(undefined :: a)’ of ‘f’ does not have a fixed runtime representation. Its type is: a :: TYPE rep - • In the first argument of ‘f’, namely ‘(undefined :: a)’ - In the expression: f (undefined :: a) + • In the expression: f (undefined :: a) In an equation for ‘foo’: foo f = f (undefined :: a) diff --git a/testsuite/tests/rep-poly/RepPolyArrowFun.stderr b/testsuite/tests/rep-poly/RepPolyArrowFun.stderr index 014dc19144..db14b272f3 100644 --- a/testsuite/tests/rep-poly/RepPolyArrowFun.stderr +++ b/testsuite/tests/rep-poly/RepPolyArrowFun.stderr @@ -22,7 +22,7 @@ RepPolyArrowFun.hs:29:9: error: In an equation for ‘foo’: foo _ = proc x -> undefined -< x RepPolyArrowFun.hs:29:19: error: - • The function un the first order arrow application of + • The function in the first order arrow application of ‘undefined’ to ‘x’ diff --git a/testsuite/tests/rep-poly/RepPolyBackpack1.stderr b/testsuite/tests/rep-poly/RepPolyBackpack1.stderr index 9f3d77ff46..f521ada91c 100644 --- a/testsuite/tests/rep-poly/RepPolyBackpack1.stderr +++ b/testsuite/tests/rep-poly/RepPolyBackpack1.stderr @@ -8,42 +8,19 @@ RepPolyBackpack1.bkp:17:5: error: Its type is: Number l :: TYPE (Rep l) -RepPolyBackpack1.bkp:17:22: error: - • The function argument - ‘x’ +RepPolyBackpack1.bkp:17:17: error: + • The argument ‘x’ of ‘plus’ does not have a fixed runtime representation. Its type is: Number l :: TYPE (Rep l) - • In the first argument of ‘plus’, namely ‘x’ - In the expression: plus x (multiply x y) + • In the expression: plus x (multiply x y) In an equation for ‘funcA’: funcA x y = plus x (multiply x y) -RepPolyBackpack1.bkp:17:24: error: - • The function argument - ‘(multiply x y)’ +RepPolyBackpack1.bkp:17:25: error: + • The argument ‘x’ of ‘multiply’ does not have a fixed runtime representation. Its type is: Number l :: TYPE (Rep l) • In the second argument of ‘plus’, namely ‘(multiply x y)’ In the expression: plus x (multiply x y) In an equation for ‘funcA’: funcA x y = plus x (multiply x y) - -RepPolyBackpack1.bkp:17:34: error: - • The function argument - ‘x’ - does not have a fixed runtime representation. - Its type is: - Number l :: TYPE (Rep l) - • In the first argument of ‘multiply’, namely ‘x’ - In the second argument of ‘plus’, namely ‘(multiply x y)’ - In the expression: plus x (multiply x y) - -RepPolyBackpack1.bkp:17:36: error: - • The function argument - ‘y’ - does not have a fixed runtime representation. - Its type is: - Number l :: TYPE (Rep l) - • In the second argument of ‘multiply’, namely ‘y’ - In the second argument of ‘plus’, namely ‘(multiply x y)’ - In the expression: plus x (multiply x y) diff --git a/testsuite/tests/rep-poly/RepPolyBinder.stderr b/testsuite/tests/rep-poly/RepPolyBinder.stderr index 177a4865e6..33802a0621 100644 --- a/testsuite/tests/rep-poly/RepPolyBinder.stderr +++ b/testsuite/tests/rep-poly/RepPolyBinder.stderr @@ -8,3 +8,12 @@ RepPolyBinder.hs:11:1: error: does not have a fixed runtime representation. Its type is: b :: TYPE rep2 + +RepPolyBinder.hs:11:17: error: + • The first argument of the view pattern + myId + does not have a fixed runtime representation. + Its type is: + b :: TYPE rep2 + • In the pattern: myId -> bndr_b + In an equation for ‘foo’: foo bndr_a pat@(myId -> bndr_b) = () diff --git a/testsuite/tests/rep-poly/RepPolyCase1.hs b/testsuite/tests/rep-poly/RepPolyCase1.hs new file mode 100644 index 0000000000..11579c563f --- /dev/null +++ b/testsuite/tests/rep-poly/RepPolyCase1.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE EmptyCase #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} + +module RepPolyCase1 where + +import GHC.Exts + +bar :: forall {r} (a :: TYPE r). () -> a +bar = error "no bar" + +x :: forall {r} (a :: TYPE r) proxy. proxy a -> () +x _ = case bar @a () of {} + diff --git a/testsuite/tests/rep-poly/RepPolyCase1.stderr b/testsuite/tests/rep-poly/RepPolyCase1.stderr new file mode 100644 index 0000000000..4804a67f8a --- /dev/null +++ b/testsuite/tests/rep-poly/RepPolyCase1.stderr @@ -0,0 +1,8 @@ + +RepPolyCase1.hs:14:7: error: + • The scrutinee of the case statement + does not have a fixed runtime representation. + Its type is: + a :: TYPE r + • In the expression: case bar @a () of {} + In an equation for ‘x’: x _ = case bar @a () of {} diff --git a/testsuite/tests/rep-poly/RepPolyCase2.hs b/testsuite/tests/rep-poly/RepPolyCase2.hs new file mode 100644 index 0000000000..5b8b355fee --- /dev/null +++ b/testsuite/tests/rep-poly/RepPolyCase2.hs @@ -0,0 +1,33 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE EmptyCase #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} + +module RepPolyCase2 where + +import Data.Kind +import GHC.Exts + +type Rep :: Type -> RuntimeRep +type family Rep a + +class Unboxable a where + type Unbox a :: TYPE (Rep a) + unbox :: a -> Unbox a + +type instance Rep Int = IntRep +instance Unboxable Int where + type Unbox Int = Int# + unbox (I# i#) = i# + +type instance Rep Double = DoubleRep +instance Unboxable Double where + type Unbox Double = Double# + unbox (D# d#) = d# + +x :: () -> () +x _ = case unbox (3 :: Int) of { _ -> () } diff --git a/testsuite/tests/rep-poly/RepPolyCase2.stderr b/testsuite/tests/rep-poly/RepPolyCase2.stderr new file mode 100644 index 0000000000..f1f59116c9 --- /dev/null +++ b/testsuite/tests/rep-poly/RepPolyCase2.stderr @@ -0,0 +1,11 @@ + +RepPolyCase2.hs:33:7: error: + • The scrutinee of the case statement + does not have a fixed runtime representation. + Its type is: + Unbox Int :: TYPE (Rep Int) + NB: GHC does not (yet) support rewriting in runtime representations. + Please comment on GHC ticket #13105 if this is causing you trouble. + <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> + • In the expression: case unbox (3 :: Int) of _ -> () + In an equation for ‘x’: x _ = case unbox (3 :: Int) of _ -> () diff --git a/testsuite/tests/rep-poly/RepPolyDoBind.stderr b/testsuite/tests/rep-poly/RepPolyDoBind.stderr index ff92a1ae26..b3541dc5d5 100644 --- a/testsuite/tests/rep-poly/RepPolyDoBind.stderr +++ b/testsuite/tests/rep-poly/RepPolyDoBind.stderr @@ -1,7 +1,7 @@ RepPolyDoBind.hs:26:3: error: - • The first argument to (>>=), - arising from the ‘do’ statement, + • The first argument of the rebindable syntax operator ‘(>>=)’ + arising from a do statement does not have a fixed runtime representation. Its type is: ma0 :: TYPE rep diff --git a/testsuite/tests/rep-poly/RepPolyDoBody1.stderr b/testsuite/tests/rep-poly/RepPolyDoBody1.stderr index 8779c23b39..f71deeb24b 100644 --- a/testsuite/tests/rep-poly/RepPolyDoBody1.stderr +++ b/testsuite/tests/rep-poly/RepPolyDoBody1.stderr @@ -1,12 +1,12 @@ RepPolyDoBody1.hs:24:3: error: - • • The first argument to (>>), - arising from the ‘do’ statement, + • • The first argument of the rebindable syntax operator ‘(>>)’ + arising from a do statement does not have a fixed runtime representation. Its type is: ma :: TYPE rep - • The second argument to (>>), - arising from the ‘do’ statement, + • The first argument of the rebindable syntax operator ‘(>>)’ + arising from a do statement does not have a fixed runtime representation. Its type is: mb0 :: TYPE rep diff --git a/testsuite/tests/rep-poly/RepPolyDoBody2.stderr b/testsuite/tests/rep-poly/RepPolyDoBody2.stderr index 5d83af9891..1d28c20d26 100644 --- a/testsuite/tests/rep-poly/RepPolyDoBody2.stderr +++ b/testsuite/tests/rep-poly/RepPolyDoBody2.stderr @@ -1,7 +1,7 @@ RepPolyDoBody2.hs:23:3: error: - • The second argument to (>>), - arising from the ‘do’ statement, + • The first argument of the rebindable syntax operator ‘(>>)’ + arising from a do statement does not have a fixed runtime representation. Its type is: mb0 :: TYPE rep diff --git a/testsuite/tests/rep-poly/RepPolyFFI.hs b/testsuite/tests/rep-poly/RepPolyFFI.hs new file mode 100644 index 0000000000..4dabe7b7a6 --- /dev/null +++ b/testsuite/tests/rep-poly/RepPolyFFI.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE UnliftedFFITypes #-} + +module RepPolyFFI1 where + +import GHC.Exts + +foreign import ccall safe "foo" foo + :: forall {l} (a :: TYPE (BoxedRep l)). Array# a -> Array# a diff --git a/testsuite/tests/rep-poly/RepPolyLeftSection2.stderr b/testsuite/tests/rep-poly/RepPolyLeftSection2.stderr index 6d299f2fed..fd9dbb31b1 100644 --- a/testsuite/tests/rep-poly/RepPolyLeftSection2.stderr +++ b/testsuite/tests/rep-poly/RepPolyLeftSection2.stderr @@ -1,10 +1,8 @@ RepPolyLeftSection2.hs:14:11: error: - • The function argument - ‘undefined’ + • The argument ‘undefined’ of ‘f’ does not have a fixed runtime representation. Its type is: a :: TYPE r - • In the expression: undefined - In the expression: undefined `f` + • In the expression: undefined `f` In an equation for ‘test1’: test1 = (undefined `f`) diff --git a/testsuite/tests/rep-poly/RepPolyMatch.stderr b/testsuite/tests/rep-poly/RepPolyMatch.stderr index 7573de3c18..420c38efe2 100644 --- a/testsuite/tests/rep-poly/RepPolyMatch.stderr +++ b/testsuite/tests/rep-poly/RepPolyMatch.stderr @@ -1,6 +1,6 @@ RepPolyMatch.hs:11:9: error: - • The first pattern in the case alternative + • The binder of the lambda-case expression does not have a fixed runtime representation. Its type is: a :: TYPE rep diff --git a/testsuite/tests/rep-poly/RepPolyMcBind.stderr b/testsuite/tests/rep-poly/RepPolyMcBind.stderr index 2febf28b9f..647a8d625d 100644 --- a/testsuite/tests/rep-poly/RepPolyMcBind.stderr +++ b/testsuite/tests/rep-poly/RepPolyMcBind.stderr @@ -1,7 +1,7 @@ RepPolyMcBind.hs:26:16: error: - • The first argument to (>>=), - arising from the monad comprehension, + • The first argument of the rebindable syntax operator ‘(>>=)’ + arising from a statement in a monad comprehension does not have a fixed runtime representation. Its type is: ma :: TYPE rep diff --git a/testsuite/tests/rep-poly/RepPolyMcBody.stderr b/testsuite/tests/rep-poly/RepPolyMcBody.stderr index 56df668fdd..de9848d4c6 100644 --- a/testsuite/tests/rep-poly/RepPolyMcBody.stderr +++ b/testsuite/tests/rep-poly/RepPolyMcBody.stderr @@ -1,7 +1,7 @@ RepPolyMcBody.hs:30:16: error: - • The first argument to (>>), - arising from the monad comprehension, + • The first argument of the rebindable syntax operator ‘(>>)’ + arising from a statement in a monad comprehension does not have a fixed runtime representation. Its type is: ma0 :: TYPE rep diff --git a/testsuite/tests/rep-poly/RepPolyMcGuard.stderr b/testsuite/tests/rep-poly/RepPolyMcGuard.stderr index 46addb9982..a1a32f7a3a 100644 --- a/testsuite/tests/rep-poly/RepPolyMcGuard.stderr +++ b/testsuite/tests/rep-poly/RepPolyMcGuard.stderr @@ -1,12 +1,12 @@ RepPolyMcGuard.hs:30:16: error: - • • The first argument to (>>), - arising from the monad comprehension, + • • The first argument of the rebindable syntax operator ‘(>>)’ + arising from a statement in a monad comprehension does not have a fixed runtime representation. Its type is: ma0 :: TYPE rep - • The argument to ‘guard’, - arising from the monad comprehension, + • The first argument of the rebindable syntax operator ‘guard’ + arising from a statement in a monad comprehension does not have a fixed runtime representation. Its type is: a0 :: TYPE rep diff --git a/testsuite/tests/rep-poly/RepPolyNPlusK.stderr b/testsuite/tests/rep-poly/RepPolyNPlusK.stderr index 80672387db..c5e5f84662 100644 --- a/testsuite/tests/rep-poly/RepPolyNPlusK.stderr +++ b/testsuite/tests/rep-poly/RepPolyNPlusK.stderr @@ -4,3 +4,12 @@ RepPolyNPlusK.hs:22:1: error: does not have a fixed runtime representation. Its type is: a :: TYPE rep1 + +RepPolyNPlusK.hs:22:6: error: + • The first argument of the rebindable syntax operator ‘(>=)’ + arising from the literal ‘2’ + does not have a fixed runtime representation. + Its type is: + a :: TYPE rep1 + • In the pattern: bndr_a+2 + In an equation for ‘foo’: foo (bndr_a+2) = () diff --git a/testsuite/tests/rep-poly/RepPolyNewtypePat1.stderr b/testsuite/tests/rep-poly/RepPolyNewtypePat1.stderr index 6981d02016..b49bd58f2a 100644 --- a/testsuite/tests/rep-poly/RepPolyNewtypePat1.stderr +++ b/testsuite/tests/rep-poly/RepPolyNewtypePat1.stderr @@ -4,3 +4,11 @@ RepPolyNewtypePat1.hs:16:1: error: does not have a fixed runtime representation. Its type is: X a :: TYPE rep + +RepPolyNewtypePat1.hs:16:6: error: + • The newtype constructor pattern + does not have a fixed runtime representation. + Its type is: + a :: TYPE rep + • In the pattern: MkX bndr_a + In an equation for ‘bar’: bar (MkX bndr_a) = bndr_a diff --git a/testsuite/tests/rep-poly/RepPolyRecordPattern.stderr b/testsuite/tests/rep-poly/RepPolyRecordPattern.stderr index 50651762dd..085e2da393 100644 --- a/testsuite/tests/rep-poly/RepPolyRecordPattern.stderr +++ b/testsuite/tests/rep-poly/RepPolyRecordPattern.stderr @@ -1,12 +1,24 @@ RepPolyRecordPattern.hs:7:35: error: - The first pattern in the equation for ‘fld’ - does not have a fixed runtime representation. - Its type is: - X a :: TYPE rep + • The newtype constructor pattern + does not have a fixed runtime representation. + Its type is: + a :: TYPE rep + • The first pattern in the equation for ‘fld’ + does not have a fixed runtime representation. + Its type is: + X a :: TYPE rep RepPolyRecordPattern.hs:13:1: error: The first pattern in the equation for ‘upd’ does not have a fixed runtime representation. Its type is: X a :: TYPE rep + +RepPolyRecordPattern.hs:13:7: error: + • The newtype constructor pattern + does not have a fixed runtime representation. + Its type is: + a :: TYPE rep + • In the pattern: MkX bndr_a + In an equation for ‘upd’: upd (MkX bndr_a) = bndr_a diff --git a/testsuite/tests/rep-poly/RepPolyRecordUpdate.stderr b/testsuite/tests/rep-poly/RepPolyRecordUpdate.stderr index 9189df8168..5cdc9205f0 100644 --- a/testsuite/tests/rep-poly/RepPolyRecordUpdate.stderr +++ b/testsuite/tests/rep-poly/RepPolyRecordUpdate.stderr @@ -1,9 +1,13 @@ RepPolyRecordUpdate.hs:7:35: error: - The first pattern in the equation for ‘fld’ - does not have a fixed runtime representation. - Its type is: - X a :: TYPE rep + • The newtype constructor pattern + does not have a fixed runtime representation. + Its type is: + a :: TYPE rep + • The first pattern in the equation for ‘fld’ + does not have a fixed runtime representation. + Its type is: + X a :: TYPE rep RepPolyRecordUpdate.hs:13:9: error: • The record update at field ‘fld’ diff --git a/testsuite/tests/rep-poly/RepPolyRule1.stderr b/testsuite/tests/rep-poly/RepPolyRule1.stderr index bef17d948f..f2fcb378da 100644 --- a/testsuite/tests/rep-poly/RepPolyRule1.stderr +++ b/testsuite/tests/rep-poly/RepPolyRule1.stderr @@ -1,10 +1,8 @@ -RepPolyRule1.hs:11:51: error: - • The function argument - ‘x’ +RepPolyRule1.hs:11:49: error: + • The argument ‘x’ of ‘f’ does not have a fixed runtime representation. Its type is: a :: TYPE rep - • In the first argument of ‘f’, namely ‘x’ - In the expression: f x + • In the expression: f x When checking the rewrite rule "f_id" diff --git a/testsuite/tests/rep-poly/RepPolyRule2.stderr b/testsuite/tests/rep-poly/RepPolyRule2.stderr index 70bd7eaa3a..82403d3c7d 100644 --- a/testsuite/tests/rep-poly/RepPolyRule2.stderr +++ b/testsuite/tests/rep-poly/RepPolyRule2.stderr @@ -1,10 +1,8 @@ -RepPolyRule2.hs:17:55: error: - • The function argument - ‘x’ +RepPolyRule2.hs:17:53: error: + • The argument ‘x’ of ‘f’ does not have a fixed runtime representation. Its type is: a :: TYPE (F rep) - • In the first argument of ‘f’, namely ‘x’ - In the expression: f x + • In the expression: f x When checking the rewrite rule "f_id" diff --git a/testsuite/tests/rep-poly/RepPolyRule3.stderr b/testsuite/tests/rep-poly/RepPolyRule3.stderr index 524ddfd3e0..cdbfcdb66b 100644 --- a/testsuite/tests/rep-poly/RepPolyRule3.stderr +++ b/testsuite/tests/rep-poly/RepPolyRule3.stderr @@ -1,26 +1,24 @@ -RepPolyRule3.hs:17:59: error: - • The function argument - ‘x’ +RepPolyRule3.hs:17:57: error: + • The argument ‘x’ of ‘g’ does not have a fixed runtime representation. - Its type is: - a :: TYPE (F 'WordRep) + Its kind is: + TYPE (F 'WordRep) + (Use -fprint-explicit-coercions to see the full type.) NB: GHC does not (yet) support rewriting in runtime representations. Please comment on GHC ticket #13105 if this is causing you trouble. <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> - • In the first argument of ‘g’, namely ‘x’ - In the expression: g x + • In the expression: g x When checking the rewrite rule "g_id" -RepPolyRule3.hs:23:54: error: - • The function argument - ‘x’ +RepPolyRule3.hs:23:52: error: + • The argument ‘x’ of ‘h’ does not have a fixed runtime representation. - Its type is: - a :: TYPE (F 'WordRep) + Its kind is: + TYPE (F 'WordRep) + (Use -fprint-explicit-coercions to see the full type.) NB: GHC does not (yet) support rewriting in runtime representations. Please comment on GHC ticket #13105 if this is causing you trouble. <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> - • In the first argument of ‘h’, namely ‘x’ - In the expression: h x + • In the expression: h x When checking the rewrite rule "h_id" diff --git a/testsuite/tests/rep-poly/RepPolyUnboxedPatterns.stderr b/testsuite/tests/rep-poly/RepPolyUnboxedPatterns.stderr index 7efa7431c5..a2d6e6bd1d 100644 --- a/testsuite/tests/rep-poly/RepPolyUnboxedPatterns.stderr +++ b/testsuite/tests/rep-poly/RepPolyUnboxedPatterns.stderr @@ -6,7 +6,7 @@ RepPolyUnboxedPatterns.hs:8:1: error: (# a, b #) :: TYPE ('TupleRep '[rep1, rep2]) RepPolyUnboxedPatterns.hs:11:1: error: - The first pattern in the equation for ‘bar’ + The first pattern in the equations for ‘bar’ does not have a fixed runtime representation. Its type is: (# a | b #) :: TYPE ('SumRep '[rep1, rep2]) diff --git a/testsuite/tests/rep-poly/RepPolyUnliftedDatatype2.hs b/testsuite/tests/rep-poly/RepPolyUnliftedDatatype2.hs new file mode 100644 index 0000000000..b16480f0ef --- /dev/null +++ b/testsuite/tests/rep-poly/RepPolyUnliftedDatatype2.hs @@ -0,0 +1,34 @@ + +{-# LANGUAGE UnliftedDatatypes #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE RankNTypes #-} + +module RepPolyUnliftedDatatype2 where + +import GHC.Exts + +type Interpret :: Bool -> Levity +type family Interpret b where + Interpret True = Lifted + Interpret False = Unlifted + +type A :: TYPE (BoxedRep (Interpret b)) +data A = MkA Int + +a :: A @True +a = MkA 42 + +-- type Interpret :: Bool -> RuntimeRep +-- type family Interpret b where +-- Interpret True = BoxedRep Lifted +-- Interpret False = BoxedRep Unlifted +-- +-- type A :: TYPE (Interpret b) +-- data A = MkA Int +-- +-- data B :: TYPE (Interpret b) where +-- MkB :: Int -> B @b diff --git a/testsuite/tests/rep-poly/T11473.stderr b/testsuite/tests/rep-poly/T11473.stderr index 2a4e92eae9..411e074c0e 100644 --- a/testsuite/tests/rep-poly/T11473.stderr +++ b/testsuite/tests/rep-poly/T11473.stderr @@ -5,12 +5,10 @@ T11473.hs:19:1: error: Its type is: a :: TYPE r -T11473.hs:19:17: error: - • The function argument - ‘x’ +T11473.hs:19:11: error: + • The argument ‘x’ of ‘boxed’ does not have a fixed runtime representation. Its type is: a :: TYPE r - • In the first argument of ‘boxed’, namely ‘x’ - In the expression: boxed x + • In the expression: boxed x In an equation for ‘hello’: hello x = boxed x diff --git a/testsuite/tests/rep-poly/T12709.stderr b/testsuite/tests/rep-poly/T12709.stderr index 78ebe39a7c..782f995942 100644 --- a/testsuite/tests/rep-poly/T12709.stderr +++ b/testsuite/tests/rep-poly/T12709.stderr @@ -1,40 +1,13 @@ T12709.hs:28:13: error: - • The function argument - ‘1’ + • The argument ‘1 + 2 + 3’ of ‘(+)’ does not have a fixed runtime representation. Its type is: a :: TYPE rep - • In the first argument of ‘(+)’, namely ‘1’ - In the first argument of ‘(+)’, namely ‘1 + 2’ - In the first argument of ‘(+)’, namely ‘1 + 2 + 3’ - -T12709.hs:28:17: error: - • The function argument - ‘2’ - does not have a fixed runtime representation. - Its type is: - a :: TYPE rep - • In the second argument of ‘(+)’, namely ‘2’ - In the first argument of ‘(+)’, namely ‘1 + 2’ - In the first argument of ‘(+)’, namely ‘1 + 2 + 3’ - -T12709.hs:28:21: error: - • The function argument - ‘3’ - does not have a fixed runtime representation. - Its type is: - a :: TYPE rep - • In the second argument of ‘(+)’, namely ‘3’ - In the first argument of ‘(+)’, namely ‘1 + 2 + 3’ - In the expression: 1 + 2 + 3 + 4 - -T12709.hs:28:25: error: - • The function argument - ‘4’ - does not have a fixed runtime representation. - Its type is: - a :: TYPE rep - • In the second argument of ‘(+)’, namely ‘4’ - In the expression: 1 + 2 + 3 + 4 + • In the expression: 1 + 2 + 3 + 4 In an equation for ‘u’: u = 1 + 2 + 3 + 4 + In the expression: + let + u :: Num (a :: TYPE rep) => a + u = 1 + 2 + 3 + 4 + in BUB u u diff --git a/testsuite/tests/rep-poly/T12973.stderr b/testsuite/tests/rep-poly/T12973.stderr index 1f677f3050..7a70b92859 100644 --- a/testsuite/tests/rep-poly/T12973.stderr +++ b/testsuite/tests/rep-poly/T12973.stderr @@ -1,20 +1,8 @@ T12973.hs:13:7: error: - • The function argument - ‘3’ + • The argument ‘3’ of ‘(+)’ does not have a fixed runtime representation. Its type is: a :: TYPE r - • In the first argument of ‘(+)’, namely ‘3’ - In the expression: 3 + 4 - In an equation for ‘foo’: foo = 3 + 4 - -T12973.hs:13:11: error: - • The function argument - ‘4’ - does not have a fixed runtime representation. - Its type is: - a :: TYPE r - • In the second argument of ‘(+)’, namely ‘4’ - In the expression: 3 + 4 + • In the expression: 3 + 4 In an equation for ‘foo’: foo = 3 + 4 diff --git a/testsuite/tests/rep-poly/T14765.stderr b/testsuite/tests/rep-poly/T14765.stderr index 57281f6507..0b70a16404 100644 --- a/testsuite/tests/rep-poly/T14765.stderr +++ b/testsuite/tests/rep-poly/T14765.stderr @@ -1,10 +1,10 @@ -T14765.hs:11:31: error: - • The function argument - ‘(k proxy#)’ +T14765.hs:11:29: error: + • The argument ‘(k proxy#)’ of ‘f’ does not have a fixed runtime representation. Its type is: r :: TYPE rep - • In the first argument of ‘f’, namely ‘(k proxy#)’ - In the second argument of ‘fold’, namely ‘(f (k proxy#) x)’ + • In the second argument of ‘fold’, namely ‘(f (k proxy#) x)’ In the expression: fold f (f (k proxy#) x) xs + In an equation for ‘fold’: + fold f k (x : xs) = fold f (f (k proxy#) x) xs diff --git a/testsuite/tests/rep-poly/T17021.stderr b/testsuite/tests/rep-poly/T17021.stderr index accd9c1560..0521ed1259 100644 --- a/testsuite/tests/rep-poly/T17021.stderr +++ b/testsuite/tests/rep-poly/T17021.stderr @@ -1,13 +1,12 @@ -T17021.hs:18:9: error: - • The function argument - ‘42’ +T17021.hs:18:5: error: + • The argument ‘42’ of ‘MkT’ does not have a fixed runtime representation. - Its type is: - Int :: TYPE (Id LiftedRep) + Its kind is: + TYPE (Id LiftedRep) + (Use -fprint-explicit-coercions to see the full type.) NB: GHC does not (yet) support rewriting in runtime representations. Please comment on GHC ticket #13105 if this is causing you trouble. <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> - • In the first argument of ‘MkT’, namely ‘42’ - In the expression: MkT 42 + • In the expression: MkT 42 In an equation for ‘f’: f = MkT 42 diff --git a/testsuite/tests/rep-poly/T17536b.stderr b/testsuite/tests/rep-poly/T17536b.stderr index 0682f44282..a2d161038a 100644 --- a/testsuite/tests/rep-poly/T17536b.stderr +++ b/testsuite/tests/rep-poly/T17536b.stderr @@ -1,6 +1,6 @@ T17536b.hs:19:7: error: - • The first pattern in the lambda abstraction + • The binder of the lambda expression does not have a fixed runtime representation. Its type is: a :: TYPE r @@ -11,7 +11,7 @@ T17536b.hs:19:7: error: In an equation for ‘g’: g L = \ _ -> 0 T17536b.hs:20:7: error: - • The first pattern in the lambda abstraction + • The binder of the lambda expression does not have a fixed runtime representation. Its type is: a :: TYPE r diff --git a/testsuite/tests/rep-poly/T19615.stderr b/testsuite/tests/rep-poly/T19615.stderr index aff0d742cf..873b3816f9 100644 --- a/testsuite/tests/rep-poly/T19615.stderr +++ b/testsuite/tests/rep-poly/T19615.stderr @@ -1,10 +1,9 @@ -T19615.hs:17:20: error: - • The function argument - ‘(f x)’ +T19615.hs:17:14: error: + • The argument ‘(f x)’ of ‘lift'’ does not have a fixed runtime representation. Its type is: b :: TYPE r' - • In the first argument of ‘lift'’, namely ‘(f x)’ - In the expression: lift' (f x) id + • In the expression: lift' (f x) id In an equation for ‘mapF’: mapF f x = lift' (f x) id + In the instance declaration for ‘Call LiftedRep’ diff --git a/testsuite/tests/rep-poly/T19709b.stderr b/testsuite/tests/rep-poly/T19709b.stderr index 63aa0f3751..6592f2d67f 100644 --- a/testsuite/tests/rep-poly/T19709b.stderr +++ b/testsuite/tests/rep-poly/T19709b.stderr @@ -1,10 +1,13 @@ -T19709b.hs:11:14: error: - • The function argument - ‘(error @Any "e2")’ +T19709b.hs:11:7: error: + • The argument ‘(error @Any "e2")’ of ‘levfun’ does not have a fixed runtime representation. Its type is: a0 :: TYPE Any - • In the first argument of ‘levfun’, namely ‘(error @Any "e2")’ - In the first argument of ‘seq’, namely ‘levfun (error @Any "e2")’ + • In the first argument of ‘seq’, namely ‘levfun (error @Any "e2")’ In the expression: levfun (error @Any "e2") `seq` return [] + In the expression: + let + levfun :: forall (r :: RuntimeRep) (a :: TYPE r). a -> () + levfun = error "e1" + in levfun (error @Any "e2") `seq` return [] diff --git a/testsuite/tests/rep-poly/T20113.hs b/testsuite/tests/rep-poly/T20113.hs index da01589dfb..40184483df 100644 --- a/testsuite/tests/rep-poly/T20113.hs +++ b/testsuite/tests/rep-poly/T20113.hs @@ -1,4 +1,7 @@ {-# LANGUAGE PolyKinds, UnliftedNewtypes, NoFieldSelectors #-} + +module T20113 where + import GHC.Exts newtype Y (a :: TYPE rep) = MkY { y_fld :: a } diff --git a/testsuite/tests/rep-poly/T20113.stderr b/testsuite/tests/rep-poly/T20113.stderr index da8439e9e7..2e51b23d85 100644 --- a/testsuite/tests/rep-poly/T20113.stderr +++ b/testsuite/tests/rep-poly/T20113.stderr @@ -1,6 +1,10 @@ -T20113.hs:4:35: error: - The first pattern in the equation for ‘$sel:y_fld:MkY’ - does not have a fixed runtime representation. - Its type is: - Y a :: TYPE rep +T20113.hs:7:35: error: + • The newtype constructor pattern + does not have a fixed runtime representation. + Its type is: + a :: TYPE rep + • The first pattern in the equation for ‘$sel:y_fld:MkY’ + does not have a fixed runtime representation. + Its type is: + Y a :: TYPE rep diff --git a/testsuite/tests/rep-poly/T20363.hs b/testsuite/tests/rep-poly/T20363.hs index a28e483ffb..f6ab357972 100644 --- a/testsuite/tests/rep-poly/T20363.hs +++ b/testsuite/tests/rep-poly/T20363.hs @@ -12,37 +12,12 @@ module T20363 where import GHC.Exts -data Nat = Zero | Suc Nat +type NilRep :: RuntimeRep +type family NilRep where + NilRep = TupleRep '[] -type NestedTupleRep :: Nat -> RuntimeRep -> RuntimeRep -type family NestedTupleRep n r where - NestedTupleRep Zero r = TupleRep '[] - NestedTupleRep (Suc n) r = TupleRep '[ r, NestedTupleRep n r ] +type UnitTupleNT :: TYPE NilRep +newtype UnitTupleNT = MkNT (# #) -type NestedTuple - :: forall ( n :: Nat ) - -> forall ( r :: RuntimeRep ) - . forall ( a :: TYPE r ) - -> TYPE ( NestedTupleRep n r ) -type family NestedTuple n a where - NestedTuple Zero @r a = (# #) - NestedTuple (Suc n) @r a = (# a, NestedTuple n @r a #) - -type NestedTupleNT - :: forall ( n :: Nat ) - -> forall ( r :: RuntimeRep ) - . forall ( a :: TYPE r ) - -> TYPE ( NestedTupleRep n r ) -newtype NestedTupleNT n (a :: TYPE r) = MkNT ( NestedTuple n a ) - -test1a :: NestedTuple Zero Addr# -> Int -test1a (# #) = 0 - -test2a :: NestedTuple (Suc Zero) Addr# -> Addr# -test2a (# i, (# #) #) = i - -test1b :: NestedTupleNT Zero Addr# -> Int +test1b :: UnitTupleNT -> Int test1b ( MkNT (# #) ) = 0 - -test2b :: NestedTupleNT (Suc Zero) Addr# -> Addr# -test2b ( MkNT (# i, (# #) #) ) = i diff --git a/testsuite/tests/rep-poly/T20363.stderr b/testsuite/tests/rep-poly/T20363.stderr new file mode 100644 index 0000000000..fdc6f94db6 --- /dev/null +++ b/testsuite/tests/rep-poly/T20363.stderr @@ -0,0 +1,12 @@ + +T20363.hs:23:10: error: + • The newtype constructor pattern + does not have a fixed runtime representation. + Its kind is: + TYPE NilRep + (Use -fprint-explicit-coercions to see the full type.) + NB: GHC does not (yet) support rewriting in runtime representations. + Please comment on GHC ticket #13105 if this is causing you trouble. + <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> + • In the pattern: MkNT (##) + In an equation for ‘test1b’: test1b (MkNT (##)) = 0 diff --git a/testsuite/tests/rep-poly/T20363_show_co.hs b/testsuite/tests/rep-poly/T20363_show_co.hs new file mode 100644 index 0000000000..00a3492f3f --- /dev/null +++ b/testsuite/tests/rep-poly/T20363_show_co.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE StandaloneKindSignatures #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UnboxedTuples #-} +{-# LANGUAGE UnliftedNewtypes #-} + +module T20363_show_co where + +import GHC.Exts + +type NilRep :: RuntimeRep +type family NilRep where + NilRep = TupleRep '[] + +type UnitTupleNT :: TYPE NilRep +newtype UnitTupleNT = MkNT (# #) + +test1b :: UnitTupleNT -> Int +test1b ( MkNT (# #) ) = 0 diff --git a/testsuite/tests/rep-poly/T20363_show_co.stderr b/testsuite/tests/rep-poly/T20363_show_co.stderr new file mode 100644 index 0000000000..6b18496208 --- /dev/null +++ b/testsuite/tests/rep-poly/T20363_show_co.stderr @@ -0,0 +1,12 @@ + +T20363_show_co.hs:23:10: error: + • The newtype constructor pattern + does not have a fixed runtime representation. + Its type is: + ((# #) |> (TYPE (Sym (T20363_show_co.D:R:NilRep[0])))_N) :: TYPE + NilRep + NB: GHC does not (yet) support rewriting in runtime representations. + Please comment on GHC ticket #13105 if this is causing you trouble. + <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> + • In the pattern: MkNT (##) + In an equation for ‘test1b’: test1b (MkNT (##)) = 0 diff --git a/testsuite/tests/rep-poly/T20363b.stderr b/testsuite/tests/rep-poly/T20363b.stderr index 1d657f3237..8d2251390f 100644 --- a/testsuite/tests/rep-poly/T20363b.stderr +++ b/testsuite/tests/rep-poly/T20363b.stderr @@ -1,20 +1,41 @@ -T20363b.hs:51:24: error: - • The function argument - ‘(##)’ +T20363b.hs:45:10: error: + • The newtype constructor pattern does not have a fixed runtime representation. Its type is: NestedTuple 'Zero Addr# :: TYPE (NestedTupleRep 'Zero 'AddrRep) NB: GHC does not (yet) support rewriting in runtime representations. Please comment on GHC ticket #13105 if this is causing you trouble. <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> - • In the first argument of ‘MkNT’, namely ‘(##)’ - In the first argument of ‘test1b’, namely ‘(MkNT (##))’ + • In the pattern: MkNT (##) + In an equation for ‘test1b’: test1b (MkNT (##)) = 0 + +T20363b.hs:48:10: error: + • The newtype constructor pattern + does not have a fixed runtime representation. + Its type is: + NestedTuple ('Suc 'Zero) Addr# :: TYPE + (NestedTupleRep ('Suc 'Zero) 'AddrRep) + NB: GHC does not (yet) support rewriting in runtime representations. + Please comment on GHC ticket #13105 if this is causing you trouble. + <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> + • In the pattern: MkNT (# i, (##) #) + In an equation for ‘test2b’: test2b (MkNT (# i, (##) #)) = i + +T20363b.hs:51:19: error: + • The argument ‘(##)’ of ‘MkNT’ + does not have a fixed runtime representation. + Its type is: + NestedTuple 'Zero Addr# :: TYPE (NestedTupleRep 'Zero 'AddrRep) + NB: GHC does not (yet) support rewriting in runtime representations. + Please comment on GHC ticket #13105 if this is causing you trouble. + <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> + • In the first argument of ‘test1b’, namely ‘(MkNT (##))’ In the expression: test1b (MkNT (##)) + In an equation for ‘test1c’: test1c = test1b (MkNT (##)) -T20363b.hs:54:26: error: - • The function argument - ‘(# nullAddr#, (##) #)’ +T20363b.hs:54:21: error: + • The argument ‘(# nullAddr#, (##) #)’ of ‘MkNT’ does not have a fixed runtime representation. Its type is: NestedTuple ('Suc 'Zero) Addr# :: TYPE @@ -22,7 +43,8 @@ T20363b.hs:54:26: error: NB: GHC does not (yet) support rewriting in runtime representations. Please comment on GHC ticket #13105 if this is causing you trouble. <https://gitlab.haskell.org/ghc/ghc/-/issues/13105> - • In the first argument of ‘MkNT’, namely ‘(# nullAddr#, (##) #)’ - In the first argument of ‘test2b’, namely + • In the first argument of ‘test2b’, namely ‘(MkNT (# nullAddr#, (##) #))’ In the expression: test2b (MkNT (# nullAddr#, (##) #)) + In an equation for ‘test2c’: + test2c _ = test2b (MkNT (# nullAddr#, (##) #)) diff --git a/testsuite/tests/rep-poly/T20426.stderr b/testsuite/tests/rep-poly/T20426.stderr index 9d9db41f8a..9c4f802a1b 100644 --- a/testsuite/tests/rep-poly/T20426.stderr +++ b/testsuite/tests/rep-poly/T20426.stderr @@ -1,6 +1,6 @@ T20426.hs:15:1: error: - The first pattern in the equation for ‘getInt#’ + The first pattern in the equations for ‘getInt#’ does not have a fixed runtime representation. Its type is: LPGADT l :: TYPE ('BoxedRep l) diff --git a/testsuite/tests/rep-poly/all.T b/testsuite/tests/rep-poly/all.T index d035558ef4..e97ae78192 100644 --- a/testsuite/tests/rep-poly/all.T +++ b/testsuite/tests/rep-poly/all.T @@ -24,7 +24,6 @@ test('T20113', normal, compile_fail, ['']) test('T20277', normal, compile_fail, ['']) test('T20330a', normal, compile, ['']) test('T20330b', normal, compile, ['']) -test('T20363', normal, compile, ['']) test('T20423', normal, compile_fail, ['']) test('T20423b', normal, compile_fail, ['']) test('T20426', normal, compile_fail, ['']) @@ -40,12 +39,14 @@ test('RepPolyBackpack3', normal, backpack_compile_fail, ['']) test('RepPolyBackpack4', normal, backpack_run, ['']) test('RepPolyBackpack5', normal, backpack_run, ['']) test('RepPolyBinder', normal, compile_fail, ['']) +test('RepPolyCase1', normal, compile_fail, ['']) test('RepPolyClassMethod', normal, compile_fail, ['']) test('RepPolyDeferred', normal, compile_fail, ['']) test('RepPolyDoBind', normal, compile_fail, ['']) test('RepPolyDoBody1', normal, compile_fail, ['']) test('RepPolyDoBody2', normal, compile_fail, ['']) test('RepPolyDoReturn', normal, compile, ['']) +test('RepPolyFFI', normal, compile, ['']) test('RepPolyLeftSection1', normal, compile, ['']) test('RepPolyLeftSection2', normal, compile_fail, ['']) test('RepPolyMagic', normal, compile_fail, ['']) @@ -70,6 +71,7 @@ test('RepPolyTuple', normal, compile_fail, ['']) test('RepPolyTupleSection', normal, compile_fail, ['']) test('RepPolyUnboxedPatterns', normal, compile_fail, ['']) test('RepPolyUnliftedDatatype', normal, compile, ['']) +test('RepPolyUnliftedDatatype2', normal, compile, ['-O']) test('RepPolyWildcardPattern', normal, compile_fail, ['']) test('RepPolyWrappedVar', normal, compile_fail, ['']) test('RepPolyWrappedVar2', normal, compile, ['']) @@ -86,6 +88,10 @@ test('UnliftedNewtypesLevityBinder', normal, compile_fail, ['']) test('T13105', normal, compile_fail, ['']) ## test('T17021', normal, compile_fail, ['']) ## test('T17536b', normal, compile_fail, ['']) ## +test('T20363', normal, compile_fail, ['']) ## +test('T20363_show_co', normal, compile_fail ## + , ['-fprint-explicit-coercions']) ## test('T20363b', normal, compile_fail, ['']) ## +test('RepPolyCase2', normal, compile_fail, ['']) ## test('RepPolyRule3', normal, compile_fail, ['']) ## ###################################################################### |