summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-04-24 17:22:44 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-29 01:39:55 -0400
commit277c2f26e6966e0cfaa1ddcd297af44766f37958 (patch)
treefab5159ddfdf399e43a7660938c974b8d12c8eb1 /testsuite/tests/codeGen
parent46720997a0b1fa2971a884adf43de096ce130a7e (diff)
downloadhaskell-277c2f26e6966e0cfaa1ddcd297af44766f37958.tar.gz
Eta expand un-saturated primops
Now since we no longer try to predict CAFfyness we have no need for the solution to #16846. Eta expanding unsaturated primop applications is conceptually simpler, especially in the presence of levity polymorphism. This essentially reverts cac8dc9f51e31e4c0a6cd9bc302f7e1bc7c03beb, as suggested in #18079. Closes #18079.
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r--testsuite/tests/codeGen/should_fail/T13233.hs3
-rw-r--r--testsuite/tests/codeGen/should_fail/T13233.stderr12
-rw-r--r--testsuite/tests/codeGen/should_fail/T13233_elab.stderr9
3 files changed, 21 insertions, 3 deletions
diff --git a/testsuite/tests/codeGen/should_fail/T13233.hs b/testsuite/tests/codeGen/should_fail/T13233.hs
index 82e08e207b..f24fc03bfb 100644
--- a/testsuite/tests/codeGen/should_fail/T13233.hs
+++ b/testsuite/tests/codeGen/should_fail/T13233.hs
@@ -21,9 +21,6 @@ obscure _ = ()
quux :: ()
quux = obscure (#,#)
--- It used to be that primops has no binding. However, as described in
--- Note [Primop wrappers] in GHC.Builtin.PrimOps we now rewrite unsaturated primop
--- applications to their wrapper, which allows safe use of levity polymorphism.
primop :: forall (rep :: RuntimeRep) (a :: TYPE rep) b c.
a -> b -> (State# RealWorld -> (# State# RealWorld, c #))
-> State# RealWorld -> (# State# RealWorld, Weak# b #)
diff --git a/testsuite/tests/codeGen/should_fail/T13233.stderr b/testsuite/tests/codeGen/should_fail/T13233.stderr
index a3d77d0b73..f6254778c1 100644
--- a/testsuite/tests/codeGen/should_fail/T13233.stderr
+++ b/testsuite/tests/codeGen/should_fail/T13233.stderr
@@ -20,3 +20,15 @@ T13233.hs:22:16: error:
Levity-polymorphic arguments:
a :: TYPE rep1
b :: TYPE rep2
+
+T13233.hs:27:10: error:
+ Cannot use function with levity-polymorphic arguments:
+ mkWeak# :: a
+ -> b
+ -> (State# RealWorld -> (# State# RealWorld, c #))
+ -> State# RealWorld
+ -> (# State# RealWorld, Weak# 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 rep
diff --git a/testsuite/tests/codeGen/should_fail/T13233_elab.stderr b/testsuite/tests/codeGen/should_fail/T13233_elab.stderr
index 214e982222..40a12ecd62 100644
--- a/testsuite/tests/codeGen/should_fail/T13233_elab.stderr
+++ b/testsuite/tests/codeGen/should_fail/T13233_elab.stderr
@@ -18,3 +18,12 @@ T13233_elab.hs:25:16: error:
Levity-polymorphic arguments:
a :: TYPE rep1
b :: TYPE rep2
+
+T13233_elab.hs:33:10:
+ Cannot use function with levity-polymorphic arguments:
+ mkWeak# @rep @a @b @c :: a
+ -> b
+ -> (State# RealWorld -> (# State# RealWorld, c #))
+ -> State# RealWorld
+ -> (# State# RealWorld, Weak# b #)
+ Levity-polymorphic arguments: a :: TYPE rep