Commit a374bf93 authored by Ian Lynagh's avatar Ian Lynagh

Add a test highlighting a messy case for FFI type errors

parent 59694a79
......@@ -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, [''])
{-# 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
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment