summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-10-15 23:09:39 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-17 14:06:46 -0400
commit81740ce83976e9d6b68594f8a4b489452cca56e5 (patch)
tree7b41d1529975c2f78eaced81e26e4722d34c212f /testsuite/tests/codeGen
parent65bf3992aebb3c08f0c4e13a3fb89dd5620015a9 (diff)
downloadhaskell-81740ce83976e9d6b68594f8a4b489452cca56e5.tar.gz
Introduce Concrete# for representation polymorphism checks
PHASE 1: we never rewrite Concrete# evidence. This patch migrates all the representation polymorphism checks to the typechecker, using a new constraint form Concrete# :: forall k. k -> TupleRep '[] Whenever a type `ty` must be representation-polymorphic (e.g. it is the type of an argument to a function), we emit a new `Concrete# ty` Wanted constraint. If this constraint goes unsolved, we report a representation-polymorphism error to the user. The 'FRROrigin' datatype keeps track of the context of the representation-polymorphism check, for more informative error messages. This paves the way for further improvements, such as allowing type families in RuntimeReps and improving the soundness of typed Template Haskell. This is left as future work (PHASE 2). fixes #17907 #20277 #20330 #20423 #20426 updates haddock submodule ------------------------- Metric Decrease: T5642 -------------------------
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r--testsuite/tests/codeGen/should_fail/T13233.hs22
-rw-r--r--testsuite/tests/codeGen/should_fail/T13233.stderr22
-rw-r--r--testsuite/tests/codeGen/should_fail/T13233_elab.hs25
-rw-r--r--testsuite/tests/codeGen/should_fail/T13233_elab.stderr14
-rw-r--r--testsuite/tests/codeGen/should_fail/all.T3
5 files changed, 1 insertions, 85 deletions
diff --git a/testsuite/tests/codeGen/should_fail/T13233.hs b/testsuite/tests/codeGen/should_fail/T13233.hs
deleted file mode 100644
index c4c0480a75..0000000000
--- a/testsuite/tests/codeGen/should_fail/T13233.hs
+++ /dev/null
@@ -1,22 +0,0 @@
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE PolyKinds #-}
-{-# LANGUAGE UnboxedTuples #-}
-{-# LANGUAGE RankNTypes #-}
-{-# LANGUAGE MagicHash #-}
-module Bug where
-
-import GHC.Exts ( TYPE, RuntimeRep )
-
-class Foo (a :: TYPE rep) where
- 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 = bar (#,#)
-
-obscure :: (forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep)
- (a :: TYPE rep1) (b :: TYPE rep2).
- a -> b -> (# a, b #)) -> ()
-obscure _ = ()
-
-quux :: ()
-quux = obscure (#,#)
diff --git a/testsuite/tests/codeGen/should_fail/T13233.stderr b/testsuite/tests/codeGen/should_fail/T13233.stderr
deleted file mode 100644
index a00ccd536a..0000000000
--- a/testsuite/tests/codeGen/should_fail/T13233.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-
-T13233.hs:14:11: error:
- Cannot use function with representation-polymorphic arguments:
- (#,#) :: a -> a -> (# a, a #)
- (Note that representation-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.)
- Representation-polymorphic arguments:
- a :: TYPE rep
- a :: TYPE rep
-
-T13233.hs:22:16: error:
- Cannot use function with representation-polymorphic arguments:
- (#,#) :: a -> b -> (# a, b #)
- (Note that representation-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.)
- Representation-polymorphic arguments:
- a :: TYPE rep1
- b :: TYPE rep2
diff --git a/testsuite/tests/codeGen/should_fail/T13233_elab.hs b/testsuite/tests/codeGen/should_fail/T13233_elab.hs
deleted file mode 100644
index 96adc5ff9a..0000000000
--- a/testsuite/tests/codeGen/should_fail/T13233_elab.hs
+++ /dev/null
@@ -1,25 +0,0 @@
--- Same as T13233, but we compile with -fprint-typechecker-elaboration.
--- The error message should show an eta-expanded call to (#,#).
--- See comments at https://gitlab.haskell.org/ghc/ghc/merge_requests/2540
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE PolyKinds #-}
-{-# LANGUAGE UnboxedTuples #-}
-{-# LANGUAGE RankNTypes #-}
-{-# LANGUAGE MagicHash #-}
-module Bug where
-
-import GHC.Exts ( TYPE, RuntimeRep )
-
-class Foo (a :: TYPE rep) where
- 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 = bar (#,#)
-
-obscure :: (forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep)
- (a :: TYPE rep1) (b :: TYPE rep2).
- a -> b -> (# a, b #)) -> ()
-obscure _ = ()
-
-quux :: ()
-quux = obscure (#,#)
diff --git a/testsuite/tests/codeGen/should_fail/T13233_elab.stderr b/testsuite/tests/codeGen/should_fail/T13233_elab.stderr
deleted file mode 100644
index 6242873514..0000000000
--- a/testsuite/tests/codeGen/should_fail/T13233_elab.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-
-T13233_elab.hs:17:11: error:
- Cannot use function with representation-polymorphic arguments:
- (#,#) @rep @rep @a @a :: a -> a -> (# a, a #)
- Representation-polymorphic arguments:
- a :: TYPE rep
- a :: TYPE rep
-
-T13233_elab.hs:25:16: error:
- Cannot use function with representation-polymorphic arguments:
- (#,#) @rep1 @rep2 @a @b :: a -> b -> (# a, b #)
- Representation-polymorphic arguments:
- a :: TYPE rep1
- b :: TYPE rep2
diff --git a/testsuite/tests/codeGen/should_fail/all.T b/testsuite/tests/codeGen/should_fail/all.T
index 970c1577ca..67015e46a8 100644
--- a/testsuite/tests/codeGen/should_fail/all.T
+++ b/testsuite/tests/codeGen/should_fail/all.T
@@ -3,5 +3,4 @@
# Only the LLVM code generator consistently forces the alignment of
# memcpy operations
test('T8131', [cmm_src, only_ways(llvm_ways)], compile_fail, ['-no-hs-main'])
-test('T13233', normal, compile_fail, [''])
-test('T13233_elab', normal, compile_fail, ['-fprint-typechecker-elaboration'])
+