diff options
author | sheaf <sam.derbyshire@gmail.com> | 2021-10-15 23:09:39 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-17 14:06:46 -0400 |
commit | 81740ce83976e9d6b68594f8a4b489452cca56e5 (patch) | |
tree | 7b41d1529975c2f78eaced81e26e4722d34c212f /testsuite/tests/polykinds | |
parent | 65bf3992aebb3c08f0c4e13a3fb89dd5620015a9 (diff) | |
download | haskell-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/polykinds')
-rw-r--r-- | testsuite/tests/polykinds/T14561.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T14561.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T8132.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/polykinds/all.T | 1 |
4 files changed, 1 insertions, 29 deletions
diff --git a/testsuite/tests/polykinds/T14561.hs b/testsuite/tests/polykinds/T14561.hs deleted file mode 100644 index dede8ba2f8..0000000000 --- a/testsuite/tests/polykinds/T14561.hs +++ /dev/null @@ -1,18 +0,0 @@ -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE PolyKinds #-} -{-# LANGUAGE MagicHash #-} - -module T14561 where - -import GHC.Types -import Unsafe.Coerce - -badId :: forall r (a :: TYPE r). a -> a -badId = unsafeCoerce# --- Un-saturated application of a representation-polymorphic --- function that must be eta-expanded - -goodId :: forall (a :: Type). a -> a -goodId = unsafeCoerce# --- But this one is OK diff --git a/testsuite/tests/polykinds/T14561.stderr b/testsuite/tests/polykinds/T14561.stderr deleted file mode 100644 index 098a31127f..0000000000 --- a/testsuite/tests/polykinds/T14561.stderr +++ /dev/null @@ -1,9 +0,0 @@ - -T14561.hs:12:9: error: - Cannot use function with representation-polymorphic arguments: - unsafeCoerce# :: 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 r diff --git a/testsuite/tests/polykinds/T8132.stderr b/testsuite/tests/polykinds/T8132.stderr index f53a78cd6d..da25e7718a 100644 --- a/testsuite/tests/polykinds/T8132.stderr +++ b/testsuite/tests/polykinds/T8132.stderr @@ -1,4 +1,4 @@ T8132.hs:7:10: error: - • Class ‘Typeable’ does not support user-specified instances + • Class ‘Typeable’ does not support user-specified instances. • In the instance declaration for ‘Typeable K’ diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 275281f527..459ba1350d 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -180,7 +180,6 @@ test('T14520', normal, compile_fail, ['-fprint-explicit-kinds']) test('T11203', normal, compile_fail, ['']) test('T14555', normal, compile_fail, ['-fprint-explicit-runtime-reps']) test('T14563', normal, compile_fail, ['-fprint-explicit-runtime-reps']) -test('T14561', normal, compile_fail, ['']) test('T14580', normal, compile_fail, ['']) test('T14515', normal, compile, ['']) test('T14710', normal, compile_fail, ['']) |