diff options
author | Aaron Allen <aaron@flipstone.com> | 2022-01-09 22:12:09 -0600 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-16 02:27:48 -0400 |
commit | c1fed9da095303591c37c53bad5f5559381048d7 (patch) | |
tree | ab5e40fa10263c1c1bf8f584da0f0396f7a9de15 /testsuite/tests/ffi | |
parent | 577135bf2251cf0aecf07ebb4966659d3fcc62b5 (diff) | |
download | haskell-c1fed9da095303591c37c53bad5f5559381048d7.tar.gz |
Suggest FFI extensions as hints (#20116)
- Use extension suggestion hints instead of suggesting extensions in the
error message body for several FFI errors.
- Adds a test case for `TcRnForeignImportPrimExtNotSet`
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r-- | testsuite/tests/ffi/should_fail/T10461.stderr | 11 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/T20116.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/T20116.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/all.T | 1 |
4 files changed, 21 insertions, 5 deletions
diff --git a/testsuite/tests/ffi/should_fail/T10461.stderr b/testsuite/tests/ffi/should_fail/T10461.stderr index 3421467715..47df47b97f 100644 --- a/testsuite/tests/ffi/should_fail/T10461.stderr +++ b/testsuite/tests/ffi/should_fail/T10461.stderr @@ -1,7 +1,8 @@ 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 cheneycopy :: Any -> Word# + • Unacceptable result type in foreign declaration: + ‘Word#’ cannot be marshalled in a foreign call + UnliftedFFITypes is required to marshal unlifted types + • When checking declaration: + foreign import prim safe cheneycopy :: Any -> Word# + Suggested fix: Perhaps you intended to use UnliftedFFITypes diff --git a/testsuite/tests/ffi/should_fail/T20116.hs b/testsuite/tests/ffi/should_fail/T20116.hs new file mode 100644 index 0000000000..ca8c4fbbdf --- /dev/null +++ b/testsuite/tests/ffi/should_fail/T20116.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE ForeignFunctionInterface #-} + +module Foo where + +import GHC.Exts + +foreign import prim "test_lt" lt_s :: Int64# -> Int64# -> Int# diff --git a/testsuite/tests/ffi/should_fail/T20116.stderr b/testsuite/tests/ffi/should_fail/T20116.stderr new file mode 100644 index 0000000000..dbc06bf9a0 --- /dev/null +++ b/testsuite/tests/ffi/should_fail/T20116.stderr @@ -0,0 +1,6 @@ + +T20116.hs:8:1: error: + • `foreign import prim' requires GHCForeignImportPrim. + • When checking declaration: + foreign import prim safe "test_lt" lt_s :: Int64# -> Int64# -> Int# + Suggested fix: Perhaps you intended to use GHCForeignImportPrim diff --git a/testsuite/tests/ffi/should_fail/all.T b/testsuite/tests/ffi/should_fail/all.T index ce1c10534e..24210dcca6 100644 --- a/testsuite/tests/ffi/should_fail/all.T +++ b/testsuite/tests/ffi/should_fail/all.T @@ -16,6 +16,7 @@ test('T7506', normal, compile_fail, ['']) test('T7243', normal, compile_fail, ['']) test('T10461', normal, compile_fail, ['']) test('T16702', normal, compile_fail, ['']) +test('T20116', normal, compile_fail, ['']) # UnsafeReenter tests implementation of an undefined behavior (calling Haskell # from an unsafe foreign function) and only makes sense in non-threaded way |