Add tests for newtypes in foreign declarations.
# Note that these tests are still in a state of flux... don't believe errors
# they report. In fact, these aren't really very good tests at all...
# Note that these tests are still in a state of flux... don't believe errors
# they report. In fact, these aren't really very good tests at all...
cc005_HC_OPTS = -fvia-C
cc006_HC_OPTS = -fvia-C -fno-prune-tydecls
cc005_HC_OPTS = -fvia-C
cc006_HC_OPTS = -fvia-C -fno-prune-tydecls
--- /dev/null
+-- !!! cc008 -- foreign export dynamic returning newtype of Addr
+module Test where
+
+import Addr
+
+newtype Ptr a = Ptr Addr
+
+foreign export dynamic mkFoo :: IO () -> IO (Ptr Int)
--- /dev/null
+-- !!! cc009 -- foreign label returning newtype of Addr
+module Test where
+
+import Addr
+
+newtype Ptr a = Ptr Addr
+
+foreign label foo :: Ptr Int
--- /dev/null
+-- !!! illegal types in foreign export delarations
+
+module ShouldFail where
+
+import PrelGHC
+
+foreign export foo :: Int# -> IO ()
+foo i | i ==# 0# = return ()
+
+foreign export bar :: Int -> Int#
+bar _ = 42#
--- /dev/null
+
+cc005.hs:7:
+ Unacceptable argument type in foreign declaration: Int#
+ When checking declaration:
+ foreign export _ccall "foo" foo :: Int# -> IO ()
+
+cc005.hs:10:
+ Unacceptable result type in foreign declaration: Int#
+ When checking declaration:
+ foreign export _ccall "bar" bar :: Int -> Int#
+
+Compilation had errors
+