summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-05-04 13:41:22 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-04 16:16:12 -0400
commit445d3657aaa0860e725c525c844326557d2f39d5 (patch)
treefa963991bb8fac2b5ac2dc9092afd31a5a8aedb4 /testsuite/tests/ffi
parent934a90dd6a34d2d1100506795d5f76cd20e2c599 (diff)
downloadhaskell-445d3657aaa0860e725c525c844326557d2f39d5.tar.gz
Ensure Any is not levity-polymorphic in FFI
The previous patch forgot to account for a type such as Any @(TYPE (BoxedRep l)) for a quantified levity variable l.
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r--testsuite/tests/ffi/should_fail/T21305_fail.hs2
-rw-r--r--testsuite/tests/ffi/should_fail/T21305_fail.stderr8
2 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_fail/T21305_fail.hs b/testsuite/tests/ffi/should_fail/T21305_fail.hs
index c6f8d6863a..b7746999b8 100644
--- a/testsuite/tests/ffi/should_fail/T21305_fail.hs
+++ b/testsuite/tests/ffi/should_fail/T21305_fail.hs
@@ -4,4 +4,6 @@ module T21305_fail where
import GHC.Exts
+foreign import prim "g" g :: forall (l :: Levity). Any @(TYPE (BoxedRep l)) -> Any
+
foreign import prim "f" f :: Any @(TYPE IntRep) -> Any
diff --git a/testsuite/tests/ffi/should_fail/T21305_fail.stderr b/testsuite/tests/ffi/should_fail/T21305_fail.stderr
index d2ed006df8..fae7053d9f 100644
--- a/testsuite/tests/ffi/should_fail/T21305_fail.stderr
+++ b/testsuite/tests/ffi/should_fail/T21305_fail.stderr
@@ -2,6 +2,14 @@
T21305_fail.hs:7:1: error:
• Unacceptable argument type in foreign declaration:
Expected kind ‘Type’ or ‘UnliftedType’,
+ but ‘Any’ has kind ‘TYPE ('BoxedRep l)’
+ • When checking declaration:
+ foreign import prim safe "g" g
+ :: forall (l :: Levity). Any @(TYPE (BoxedRep l)) -> Any
+
+T21305_fail.hs:9:1: error:
+ • Unacceptable argument type in foreign declaration:
+ Expected kind ‘Type’ or ‘UnliftedType’,
but ‘Any’ has kind ‘TYPE 'IntRep’
• When checking declaration:
foreign import prim safe "f" f :: Any @(TYPE IntRep) -> Any