summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-06-02 17:37:09 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-06-02 17:37:30 +0100
commit3758050f02c1de6af41c50ed122b3df012d400ff (patch)
tree791c847a57a0544f9f423388dcaff410961655a0 /testsuite/tests/ffi
parente796026b45974d71233eef7ffb6feee482c6dd7e (diff)
downloadhaskell-3758050f02c1de6af41c50ed122b3df012d400ff.tar.gz
Improve FFI error reporting
I refactored TcType FFI functions to return Validity rather than Bool, which turned out to be an easy way to solve Trac #10461.
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r--testsuite/tests/ffi/should_fail/T10461.hs6
-rw-r--r--testsuite/tests/ffi/should_fail/T10461.stderr7
-rw-r--r--testsuite/tests/ffi/should_fail/all.T1
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_fail/T10461.hs b/testsuite/tests/ffi/should_fail/T10461.hs
new file mode 100644
index 0000000000..3db415b288
--- /dev/null
+++ b/testsuite/tests/ffi/should_fail/T10461.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE MagicHash, GHCForeignImportPrim #-}
+
+module T10461 where
+import GHC.Exts
+
+foreign import prim cheneycopy :: Any -> Word#
diff --git a/testsuite/tests/ffi/should_fail/T10461.stderr b/testsuite/tests/ffi/should_fail/T10461.stderr
new file mode 100644
index 0000000000..7962582fe2
--- /dev/null
+++ b/testsuite/tests/ffi/should_fail/T10461.stderr
@@ -0,0 +1,7 @@
+
+T10461.hs:6:1: error:
+ Unacceptable result type in foreign declaration:
+ ‘Word#’ cannot be marshalled in a foreign call
+ To marshal unlifted types, use UnliftedFFITypes
+ When checking declaration:
+ foreign import prim safe "static " cheneycopy :: Any -> Word#
diff --git a/testsuite/tests/ffi/should_fail/all.T b/testsuite/tests/ffi/should_fail/all.T
index 78b70073e5..3bb07bd429 100644
--- a/testsuite/tests/ffi/should_fail/all.T
+++ b/testsuite/tests/ffi/should_fail/all.T
@@ -17,4 +17,5 @@ test('capi_value_function', normal, compile_fail, [''])
test('T5664', normal, compile_fail, ['-v0'])
test('T7506', normal, compile_fail, [''])
test('T7243', normal, compile_fail, [''])
+test('T10461', normal, compile_fail, [''])