diff options
Diffstat (limited to 'testsuite/tests/linear')
-rw-r--r-- | testsuite/tests/linear/should_fail/LinearFFI.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/linear/should_fail/LinearFFI.stderr | 20 | ||||
-rw-r--r-- | testsuite/tests/linear/should_fail/all.T | 1 |
3 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_fail/LinearFFI.hs b/testsuite/tests/linear/should_fail/LinearFFI.hs new file mode 100644 index 0000000000..6c6e1c562a --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearFFI.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE LinearTypes #-} +module LinearFFI where -- #18472 + +import Foreign.Ptr + +foreign import ccall "exp" c_exp :: Double #-> Double +foreign import stdcall "dynamic" d8 :: FunPtr (IO Int) #-> IO Int +foreign import ccall "wrapper" mkF :: IO () #-> IO (FunPtr (IO ())) diff --git a/testsuite/tests/linear/should_fail/LinearFFI.stderr b/testsuite/tests/linear/should_fail/LinearFFI.stderr new file mode 100644 index 0000000000..41dd5e66a7 --- /dev/null +++ b/testsuite/tests/linear/should_fail/LinearFFI.stderr @@ -0,0 +1,20 @@ + +LinearFFI.hs:6:1: error: + • Unacceptable argument type in foreign declaration: + Linear types are not supported in FFI declarations, see #18472 + • When checking declaration: + foreign import ccall safe "exp" c_exp :: Double #-> Double + +LinearFFI.hs:7:1: error: + • Unacceptable argument type in foreign declaration: + Linear types are not supported in FFI declarations, see #18472 + • When checking declaration: + foreign import stdcall safe "dynamic" d8 + :: FunPtr (IO Int) #-> IO Int + +LinearFFI.hs:8:1: error: + • Unacceptable argument type in foreign declaration: + Linear types are not supported in FFI declarations, see #18472 + • When checking declaration: + foreign import ccall safe "wrapper" mkF + :: IO () #-> IO (FunPtr (IO ())) diff --git a/testsuite/tests/linear/should_fail/all.T b/testsuite/tests/linear/should_fail/all.T index 941966673c..5a79b031b6 100644 --- a/testsuite/tests/linear/should_fail/all.T +++ b/testsuite/tests/linear/should_fail/all.T @@ -28,3 +28,4 @@ test('LinearBottomMult', normal, compile_fail, ['']) test('LinearSequenceExpr', normal, compile_fail, ['']) test('LinearIf', normal, compile_fail, ['']) test('LinearPatternGuardWildcard', normal, compile_fail, ['']) +test('LinearFFI', normal, compile_fail, ['']) |