summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
diff options
context:
space:
mode:
authorLuite Stegeman <stegeman@gmail.com>2023-02-01 15:00:29 +0900
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-03-02 22:42:45 -0500
commit8919f34102cae1ff3bae95b7f53e5d93dbad7ecf (patch)
tree715699a24bb50e5691621d2a75100b1c88034048 /testsuite/tests/ffi
parent1ed573a53ee454db240b9fb1a17e28c97b6eb53a (diff)
downloadhaskell-8919f34102cae1ff3bae95b7f53e5d93dbad7ecf.tar.gz
Check for platform support for JavaScript foreign imports
GHC was accepting `foreign import javascript` declarations on non-JavaScript platforms. This adds a check so that these are only supported on an platform that supports the JavaScript calling convention. Fixes #22774
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r--testsuite/tests/ffi/should_compile/T22774.hs4
-rw-r--r--testsuite/tests/ffi/should_compile/all.T3
2 files changed, 7 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_compile/T22774.hs b/testsuite/tests/ffi/should_compile/T22774.hs
new file mode 100644
index 0000000000..a100aeffb7
--- /dev/null
+++ b/testsuite/tests/ffi/should_compile/T22774.hs
@@ -0,0 +1,4 @@
+module T22774 where
+
+foreign import javascript foo :: IO ()
+
diff --git a/testsuite/tests/ffi/should_compile/all.T b/testsuite/tests/ffi/should_compile/all.T
index 6b4c557a07..43756349d9 100644
--- a/testsuite/tests/ffi/should_compile/all.T
+++ b/testsuite/tests/ffi/should_compile/all.T
@@ -44,3 +44,6 @@ test(
)
test('T15531', normal, compile, ['-Wall'])
test('T22043', [omit_ways(['ghci'])], compile, [''])
+
+test('T22774', when(not js_arch(), expect_fail), compile, [''])
+