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/th | |
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/th')
-rw-r--r-- | testsuite/tests/th/T19709a.hs | 9 | ||||
-rw-r--r-- | testsuite/tests/th/T19709a.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/th/T19709b.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/th/T19709b.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/th/T19709d.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/th/T9084.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/th/TH_exn1.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 2 |
8 files changed, 5 insertions, 39 deletions
diff --git a/testsuite/tests/th/T19709a.hs b/testsuite/tests/th/T19709a.hs deleted file mode 100644 index 8c0e5fd665..0000000000 --- a/testsuite/tests/th/T19709a.hs +++ /dev/null @@ -1,9 +0,0 @@ -{-# LANGUAGE TemplateHaskell, ExplicitForAll, PolyKinds #-} - -module T19709a where - -import GHC.Exts - -$( let levid :: forall (r :: RuntimeRep) (a :: TYPE r). a -> a - levid x = x - in return [] ) diff --git a/testsuite/tests/th/T19709a.stderr b/testsuite/tests/th/T19709a.stderr deleted file mode 100644 index 6594949d2b..0000000000 --- a/testsuite/tests/th/T19709a.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -T19709a.hs:8:14: error: - A representation-polymorphic type is not allowed here: - Type: a - Kind: TYPE r - In the type of binder ‘x’ diff --git a/testsuite/tests/th/T19709b.hs b/testsuite/tests/th/T19709b.hs deleted file mode 100644 index 629172a892..0000000000 --- a/testsuite/tests/th/T19709b.hs +++ /dev/null @@ -1,12 +0,0 @@ -{-# LANGUAGE TemplateHaskell, ExplicitForAll, PolyKinds, TypeApplications #-} - -module T19709b where - -import GHC.Exts -import Language.Haskell.TH - -$( let levfun :: forall (r :: RuntimeRep) (a :: TYPE r). a -> () - levfun = error "e1" -- NB: this, so far, is OK: no representation-polymorphic binder - - in levfun (error @Any "e2") -- but this is very naughty: representation-polymorphic argument - `seq` return [] ) diff --git a/testsuite/tests/th/T19709b.stderr b/testsuite/tests/th/T19709b.stderr deleted file mode 100644 index fb2d55a917..0000000000 --- a/testsuite/tests/th/T19709b.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -T19709b.hs:11:14: error: - A representation-polymorphic type is not allowed here: - Type: Any - Kind: TYPE Any - In the type of expression: (error @Any "e2") diff --git a/testsuite/tests/th/T19709d.stderr b/testsuite/tests/th/T19709d.stderr index 4adadd09ba..3ee2ac8424 100644 --- a/testsuite/tests/th/T19709d.stderr +++ b/testsuite/tests/th/T19709d.stderr @@ -1,5 +1,5 @@ -T19709d.hs:6:4: warning: [-Wincomplete-patterns (in -Wextra)] +T19709d.hs:6:2: warning: [-Wincomplete-patterns (in -Wextra)] Pattern match(es) are non-exhaustive In a case alternative: Patterns of type ‘String’ not matched: @@ -11,6 +11,6 @@ T19709d.hs:6:4: warning: [-Wincomplete-patterns (in -Wextra)] T19709d.hs:1:1: error: Exception when trying to run compile-time code: - T19709d.hs:6:4-44: Non-exhaustive patterns in case + T19709d.hs:6:2-46: Non-exhaustive patterns in case Code: (case tail "hello" of "hello" -> return []) diff --git a/testsuite/tests/th/T9084.stderr b/testsuite/tests/th/T9084.stderr index ad90d1bd9c..722735d306 100644 --- a/testsuite/tests/th/T9084.stderr +++ b/testsuite/tests/th/T9084.stderr @@ -1,2 +1,3 @@ -T9084.hs:5:3: MINIMAL pragmas not (yet) handled by Template Haskell +T9084.hs:5:2: error: + MINIMAL pragmas not (yet) handled by Template Haskell diff --git a/testsuite/tests/th/TH_exn1.stderr b/testsuite/tests/th/TH_exn1.stderr index 2df704662c..540ced9278 100644 --- a/testsuite/tests/th/TH_exn1.stderr +++ b/testsuite/tests/th/TH_exn1.stderr @@ -1,6 +1,6 @@ TH_exn1.hs:1:1: error: Exception when trying to run compile-time code: - TH_exn1.hs:(9,4)-(10,23): Non-exhaustive patterns in case + TH_exn1.hs:(9,2)-(11,2): Non-exhaustive patterns in case Code: (case reverse "no" of [] -> return []) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 5bc6d89135..a5c4610598 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -516,8 +516,6 @@ test('TH_BytesShowEqOrd', normal, compile_and_run, ['']) test('T18102', normal, compile_fail, ['']) test('T18102b', extra_files(['T18102b_aux.hs']), compile_and_run, ['']) test('T18121', normal, compile, ['']) -test('T19709a', normal, compile_fail, ['']) -test('T19709b', normal, compile_fail, ['']) test('T19709c', normal, compile_fail, ['']) test('T19709d', normal, compile_fail, ['']) test('T18123', normal, compile, ['']) |