diff options
author | Ian Lynagh <igloo@earth.li> | 2011-10-01 13:31:00 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-10-01 13:31:00 +0100 |
commit | a374bf93c4f96887010fb203fd134f6b6d0cc639 (patch) | |
tree | 31b22c37942f4a5a53bd8a1ebea9a94f2788a3b3 /testsuite/tests/ffi | |
parent | 59694a791c8c0afddc205f7fb37919628350c3b4 (diff) | |
download | haskell-a374bf93c4f96887010fb203fd134f6b6d0cc639.tar.gz |
Add a test highlighting a messy case for FFI type errors
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r-- | testsuite/tests/ffi/should_fail/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/ccfail005.hs | 16 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/ccfail005.stderr | 10 |
3 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_fail/all.T b/testsuite/tests/ffi/should_fail/all.T index 4793379fb4..abba1b5f6f 100644 --- a/testsuite/tests/ffi/should_fail/all.T +++ b/testsuite/tests/ffi/should_fail/all.T @@ -7,3 +7,4 @@ test('ccfail002', only_compiler_types(['ghc']), compile_fail, ['']) test('ccfail003', only_compiler_types(['ghc']), compile_fail, ['']) test('T3066', only_compiler_types(['ghc']), compile_fail, ['']) test('ccfail004', only_compiler_types(['ghc']), multimod_compile_fail, ['ccfail004', '-v0']) +test('ccfail005', only_compiler_types(['ghc']), compile_fail, ['']) diff --git a/testsuite/tests/ffi/should_fail/ccfail005.hs b/testsuite/tests/ffi/should_fail/ccfail005.hs new file mode 100644 index 0000000000..3ba29a6d4c --- /dev/null +++ b/testsuite/tests/ffi/should_fail/ccfail005.hs @@ -0,0 +1,16 @@ + +{-# LANGUAGE TypeFamilies #-} + +module Ccfail005 where + +type family F a +type instance F Bool = D -> IO Int +type instance F Char = Int -> IO D +data D = D + +-- These should be rejected as D isn't a type we can use with the FFI. +-- Note that, in the signature the user writes, there aren't an +-- "argument type" and "result type" to complain about, though. +foreign import ccall f1 :: F Bool +foreign import ccall f2 :: F Char + diff --git a/testsuite/tests/ffi/should_fail/ccfail005.stderr b/testsuite/tests/ffi/should_fail/ccfail005.stderr new file mode 100644 index 0000000000..0d96fe91e3 --- /dev/null +++ b/testsuite/tests/ffi/should_fail/ccfail005.stderr @@ -0,0 +1,10 @@ + +ccfail005.hs:14:1: + Unacceptable argument type in foreign declaration: D + When checking declaration: + foreign import ccall safe "static f1" f1 :: F Bool + +ccfail005.hs:15:1: + Unacceptable result type in foreign declaration: IO D + When checking declaration: + foreign import ccall safe "static f2" f2 :: F Char |