From 212a79093d662ba4f019a87ad9e4a55e4c2b065a Mon Sep 17 00:00:00 2001 From: David Waern Date: Mon, 27 Oct 2008 19:59:04 +0000 Subject: Make named doc comments into ExportDoc instead of ExportDecl Fixes a crash when processing modules without export lists containing named docs. --- src/Haddock/Interface/Create.hs | 1 + tests/tests/NamedDoc.hs | 4 ++ tests/tests/NamedDoc.html.ref | 99 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 tests/tests/NamedDoc.hs create mode 100644 tests/tests/NamedDoc.html.ref diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index 25f04d31..b7c82267 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -411,6 +411,7 @@ fullContentsOfThisModule :: Module -> [DeclInfo] -> [ExportItem Name] fullContentsOfThisModule module_ decls = catMaybes (map mkExportItem decls) where mkExportItem (L _ (DocD (DocGroup lev doc)), _, _) = Just $ ExportGroup lev "" doc + mkExportItem (L _ (DocD (DocCommentNamed _ doc)), _, _) = Just $ ExportDoc doc mkExportItem (decl, doc, subs) = Just $ ExportDecl decl doc subdocs [] where subdocs = [ (n, doc) | (n, Just doc) <- subs ] diff --git a/tests/tests/NamedDoc.hs b/tests/tests/NamedDoc.hs new file mode 100644 index 00000000..7c04ba72 --- /dev/null +++ b/tests/tests/NamedDoc.hs @@ -0,0 +1,4 @@ +module NamedDoc where + +-- $foo bar + diff --git a/tests/tests/NamedDoc.html.ref b/tests/tests/NamedDoc.html.ref new file mode 100644 index 00000000..84b02e97 --- /dev/null +++ b/tests/tests/NamedDoc.html.ref @@ -0,0 +1,99 @@ + + +NamedDoc
 ContentsIndex
NamedDoc
Synopsis
Documentation
bar +
Produced by Haddock version 2.3.0
-- cgit v1.2.3