summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2016-05-11 15:58:35 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-12 15:42:56 +0200
commit697143064c271c57a69e80850a768449f8bcf4ca (patch)
treeca45b2bfec4b17eb8aaf249f308d985aefe3b606 /testsuite/tests
parentb8e2565123de45f215277e3a92fbc7ace2b8fd71 (diff)
downloadhaskell-697143064c271c57a69e80850a768449f8bcf4ca.tar.gz
Allow putting Haddocks on derived instances
Currently, one can document top-level instance declarations, but derived instances (both those in `deriving` clauses and standalone `deriving` instances) do not enjoy the same privilege. This makes the necessary changes to the parser to enable attaching Haddock comments for derived instances. Updates haddock submodule. Fixes #11768. Test Plan: ./validate Reviewers: hvr, bgamari, austin Reviewed By: austin Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2175 GHC Trac Issues: #11768
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs13
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr13
-rw-r--r--testsuite/tests/haddock/should_compile_flag_haddock/all.T1
3 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs
new file mode 100644
index 0000000000..5689b42380
--- /dev/null
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE StandaloneDeriving #-}
+module T11768 where
+
+data Foo = Foo
+ deriving Eq -- ^ Documenting a single type
+
+data Bar = Bar
+ deriving ( Eq -- ^ Documenting one of multiple types
+ , Ord
+ )
+
+-- | Documenting a standalone deriving instance
+deriving instance Read Bar
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr
new file mode 100644
index 0000000000..684a6f072a
--- /dev/null
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr
@@ -0,0 +1,13 @@
+
+==================== Parser ====================
+module T11768 where
+data Foo
+ = Foo
+ deriving (Eq Documenting a single type)
+data Bar
+ = Bar
+ deriving (Eq Documenting one of multiple types, Ord)
+<document comment>
+deriving instance Read Bar
+
+
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/all.T b/testsuite/tests/haddock/should_compile_flag_haddock/all.T
index 344210e1a0..7db4379b16 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/all.T
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/all.T
@@ -46,3 +46,4 @@ test('haddockA032', normal, compile, ['-haddock -ddump-parsed'])
test('haddockA033', normal, compile, ['-haddock -ddump-parsed'])
test('haddockA034', normal, compile, ['-haddock -ddump-parsed'])
test('T10398', normal, compile, ['-haddock -ddump-parsed'])
+test('T11768', normal, compile, ['-haddock -ddump-parsed'])