summaryrefslogtreecommitdiff
path: root/testsuite/tests/haddock
diff options
context:
space:
mode:
authorIavor Diatchki <iavor.diatchki@gmail.com>2018-06-07 13:32:27 -0400
committerBen Gamari <ben@smart-cactus.org>2018-06-07 18:06:31 -0400
commit200c8e046b44e38698d7e7bb9801f306e9570a0a (patch)
treec3e815b1c59d4fbf1c03cf4bffccf609ea1c9a63 /testsuite/tests/haddock
parentdc8c03b2a5c70d3169e88d407f3ef28e0cb26af5 (diff)
downloadhaskell-200c8e046b44e38698d7e7bb9801f306e9570a0a.tar.gz
Allow Haddock comments before function arguments.
Currently, documentation strings on function arguments has to be written after the argument (i.e., using `{-^ -}` comments). This patch allows us to use `{-| -}` comments to put the comment string before an argument. The same works for the results of functions. Reviewers: bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, mpickering, carter Differential Revision: https://phabricator.haskell.org/D4767
Diffstat (limited to 'testsuite/tests/haddock')
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr4
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs29
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr11
3 files changed, 42 insertions, 2 deletions
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr
index 94318efe2b..3021fa7195 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA038.stderr
@@ -3,5 +3,5 @@
module UnamedConstructorStrictFields where
data A = A
data B = B
-data Foo = MkFoo {-# UNPACK #-} !A Unpacked strict field B
-data Bar = {-# UNPACK #-} !A Unpacked strict field :%% B
+data Foo = MkFoo {-# UNPACK #-} !A " Unpacked strict field" B
+data Bar = {-# UNPACK #-} !A " Unpacked strict field" :%% B
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs
new file mode 100644
index 0000000000..79d23e9ec1
--- /dev/null
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.hs
@@ -0,0 +1,29 @@
+module CommentsBeforeArguments where
+
+data A = A
+data B = B
+
+f1 :: {-| Comment before -}
+ () ->
+
+ ()
+ {-^ Comment after -} ->
+
+ ()
+ {-^ Result after -}
+f1 _ _ = ()
+
+
+f2 :: {-| Comment before -}
+ () ->
+
+ ()
+ {-^ Comment after -} ->
+
+ {-| Result after -}
+ ()
+f2 _ _ = ()
+
+
+
+
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr
new file mode 100644
index 0000000000..0c12f5c62f
--- /dev/null
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/haddockA039.stderr
@@ -0,0 +1,11 @@
+
+==================== Parser ====================
+module CommentsBeforeArguments where
+f1 ::
+ () Comment before -> () Comment after -> () Result after
+f1 _ _ = ()
+f2 ::
+ () Comment before -> () Comment after -> () Result after
+f2 _ _ = ()
+
+