diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2016-11-08 21:37:48 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2016-12-07 21:31:13 +0200 |
commit | 499e43824bda967546ebf95ee33ec1f84a114a7c (patch) | |
tree | 58b313d734cfba014395ea5876db48e8400296a8 /testsuite/tests/ffi | |
parent | 83d69dca896c7df1f2a36268d5b45c9283985ebf (diff) | |
download | haskell-499e43824bda967546ebf95ee33ec1f84a114a7c.tar.gz |
Add HsSyn prettyprinter tests
Summary:
Add prettyprinter tests, which take a file, parse it, pretty print it,
re-parse the pretty printed version and then compare the original and
new ASTs (ignoring locations)
Updates haddock submodule to match the AST changes.
There are three issues outstanding
1. Extra parens around a context are not reproduced. This will require an
AST change and will be done in a separate patch.
2. Currently if an `HsTickPragma` is found, this is not pretty-printed,
to prevent noise in the output.
I am not sure what the desired behaviour in this case is, so have left
it as before. Test Ppr047 is marked as expected fail for this.
3. Apart from in a context, the ParsedSource AST keeps all the parens from
the original source. Something is happening in the renamer to remove the
parens around visible type application, causing T12530 to fail, as the
dumped splice decl is after the renamer.
This needs to be fixed by keeping the parens, but I do not know where they
are being removed. I have amended the test to pass, by removing the parens
in the expected output.
Test Plan: ./validate
Reviewers: goldfire, mpickering, simonpj, bgamari, austin
Reviewed By: simonpj, bgamari
Subscribers: simonpj, goldfire, thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2752
GHC Trac Issues: #3384
Diffstat (limited to 'testsuite/tests/ffi')
-rw-r--r-- | testsuite/tests/ffi/should_fail/T10461.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/T3066.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/T7506.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/capi_value_function.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/ccfail001.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/ccfail002.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/ccfail004.stderr | 10 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_fail/ccfail005.stderr | 6 |
8 files changed, 13 insertions, 18 deletions
diff --git a/testsuite/tests/ffi/should_fail/T10461.stderr b/testsuite/tests/ffi/should_fail/T10461.stderr index fae0f50b14..3421467715 100644 --- a/testsuite/tests/ffi/should_fail/T10461.stderr +++ b/testsuite/tests/ffi/should_fail/T10461.stderr @@ -4,4 +4,4 @@ T10461.hs:6:1: error: ‘Word#’ cannot be marshalled in a foreign call To marshal unlifted types, use UnliftedFFITypes When checking declaration: - foreign import prim safe "static cheneycopy" cheneycopy :: Any -> Word# + foreign import prim safe cheneycopy :: Any -> Word# diff --git a/testsuite/tests/ffi/should_fail/T3066.stderr b/testsuite/tests/ffi/should_fail/T3066.stderr index e6d292d4ec..3b6c3f9b47 100644 --- a/testsuite/tests/ffi/should_fail/T3066.stderr +++ b/testsuite/tests/ffi/should_fail/T3066.stderr @@ -3,5 +3,4 @@ T3066.hs:6:1: Unacceptable argument type in foreign declaration: ‘forall u. Ptr ()’ is not a data type When checking declaration: - foreign import ccall safe "static bla" bla - :: (forall u. X u) -> IO () + foreign import ccall safe bla :: (forall u. X u) -> IO () diff --git a/testsuite/tests/ffi/should_fail/T7506.stderr b/testsuite/tests/ffi/should_fail/T7506.stderr index dd893df155..9a1aa25a8e 100644 --- a/testsuite/tests/ffi/should_fail/T7506.stderr +++ b/testsuite/tests/ffi/should_fail/T7506.stderr @@ -4,5 +4,5 @@ T7506.hs:6:1: ‘Int -> IO ()’ cannot be marshalled in a foreign call A foreign-imported address (via &foo) must have type (Ptr a) or (FunPtr a) When checking declaration: - foreign import ccall safe "static stdio.h &putchar" c_putchar + foreign import ccall safe "stdio.h &putchar" c_putchar :: Int -> IO () diff --git a/testsuite/tests/ffi/should_fail/capi_value_function.stderr b/testsuite/tests/ffi/should_fail/capi_value_function.stderr index 99ffad6ab8..6732c5c2da 100644 --- a/testsuite/tests/ffi/should_fail/capi_value_function.stderr +++ b/testsuite/tests/ffi/should_fail/capi_value_function.stderr @@ -2,5 +2,4 @@ capi_value_function.hs:8:1: `value' imports cannot have function types When checking declaration: - foreign import capi safe "static math.h value sqrt" f - :: CInt -> CInt + foreign import capi safe "math.h value sqrt" f :: CInt -> CInt diff --git a/testsuite/tests/ffi/should_fail/ccfail001.stderr b/testsuite/tests/ffi/should_fail/ccfail001.stderr index e890041b02..01c7ea5d15 100644 --- a/testsuite/tests/ffi/should_fail/ccfail001.stderr +++ b/testsuite/tests/ffi/should_fail/ccfail001.stderr @@ -3,5 +3,4 @@ ccfail001.hs:10:1: Unacceptable result type in foreign declaration: ‘State# RealWorld’ cannot be marshalled in a foreign call When checking declaration: - foreign import ccall safe "static foo" foo - :: Int -> State# RealWorld + foreign import ccall safe foo :: Int -> State# RealWorld diff --git a/testsuite/tests/ffi/should_fail/ccfail002.stderr b/testsuite/tests/ffi/should_fail/ccfail002.stderr index 309fa521d2..c3c04e25d5 100644 --- a/testsuite/tests/ffi/should_fail/ccfail002.stderr +++ b/testsuite/tests/ffi/should_fail/ccfail002.stderr @@ -3,5 +3,5 @@ ccfail002.hs:10:1: Unacceptable result type in foreign declaration: ‘(# Int#, Int#, Int# #)’ cannot be marshalled in a foreign call When checking declaration: - foreign import ccall unsafe "static foo" foo + foreign import ccall unsafe "foo" foo :: Int# -> Int# -> Int# -> (# Int#, Int#, Int# #) diff --git a/testsuite/tests/ffi/should_fail/ccfail004.stderr b/testsuite/tests/ffi/should_fail/ccfail004.stderr index 825c47ca1e..60aaf30188 100644 --- a/testsuite/tests/ffi/should_fail/ccfail004.stderr +++ b/testsuite/tests/ffi/should_fail/ccfail004.stderr @@ -5,7 +5,7 @@ ccfail004.hs:9:1: because its data constructor is not in scope Possible fix: import the data constructor to bring it into scope When checking declaration: - foreign import ccall safe "static f1" f1 :: NInt -> IO Int + foreign import ccall safe f1 :: NInt -> IO Int ccfail004.hs:10:1: Unacceptable result type in foreign declaration: @@ -13,7 +13,7 @@ ccfail004.hs:10:1: because its data constructor is not in scope Possible fix: import the data constructor to bring it into scope When checking declaration: - foreign import ccall safe "static f2" f2 :: Int -> IO NInt + foreign import ccall safe f2 :: Int -> IO NInt ccfail004.hs:11:1: Unacceptable result type in foreign declaration: @@ -21,16 +21,16 @@ ccfail004.hs:11:1: because the data constructor for ‘NIO’ is not in scope Possible fix: import the data constructor to bring it into scope When checking declaration: - foreign import ccall safe "static f3" f3 :: Int -> NIO Int + foreign import ccall safe f3 :: Int -> NIO Int ccfail004.hs:14:1: Unacceptable argument type in foreign declaration: ‘[NT]’ cannot be marshalled in a foreign call When checking declaration: - foreign import ccall safe "static f4" f4 :: NT -> IO () + foreign import ccall safe f4 :: NT -> IO () ccfail004.hs:15:1: Unacceptable result type in foreign declaration: ‘[NT]’ cannot be marshalled in a foreign call When checking declaration: - foreign import ccall safe "static f5" f5 :: IO NT + foreign import ccall safe f5 :: IO NT diff --git a/testsuite/tests/ffi/should_fail/ccfail005.stderr b/testsuite/tests/ffi/should_fail/ccfail005.stderr index 413faa702c..d5e2a27901 100644 --- a/testsuite/tests/ffi/should_fail/ccfail005.stderr +++ b/testsuite/tests/ffi/should_fail/ccfail005.stderr @@ -2,11 +2,9 @@ ccfail005.hs:14:1: Unacceptable argument type in foreign declaration: ‘D’ cannot be marshalled in a foreign call - When checking declaration: - foreign import ccall safe "static f1" f1 :: F Bool + When checking declaration: foreign import ccall safe f1 :: F Bool ccfail005.hs:15:1: Unacceptable result type in foreign declaration: ‘D’ cannot be marshalled in a foreign call - When checking declaration: - foreign import ccall safe "static f2" f2 :: F Char + When checking declaration: foreign import ccall safe f2 :: F Char |