From b4b68d73df3485f3b0ea59c6170805788a09c593 Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Tue, 23 Oct 2018 11:29:14 +0200 Subject: Fix typo in a warning --- haddock-api/src/Haddock/Interface/LexParseRn.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'haddock-api') diff --git a/haddock-api/src/Haddock/Interface/LexParseRn.hs b/haddock-api/src/Haddock/Interface/LexParseRn.hs index 87face7c..b6913012 100644 --- a/haddock-api/src/Haddock/Interface/LexParseRn.hs +++ b/haddock-api/src/Haddock/Interface/LexParseRn.hs @@ -165,8 +165,7 @@ outOfScope dflags x = where warnAndMonospace a = do tell ["Warning: '" ++ showPpr dflags a ++ "' is out of scope.\n" ++ - " If you qualify the identifier, haddock can try to link it\n" ++ - " it anyway."] + " If you qualify the identifier, haddock can try to link it anyway."] pure (monospaced a) monospaced a = DocMonospaced (DocString (showPpr dflags a)) -- cgit v1.2.3 From cd520e9907b9a56cae5a2e51413eef1522a37bbb Mon Sep 17 00:00:00 2001 From: Alec Theriault Date: Thu, 25 Oct 2018 20:16:46 -0700 Subject: Avoid more conflicts in generated ids (#954) This fixes #953 by passing more names into the generated ids. --- haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 16 ++- html-test/ref/Bug953.html | 146 +++++++++++++++++++++++++ html-test/src/Bug953.hs | 17 +++ 3 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 html-test/ref/Bug953.html create mode 100644 html-test/src/Bug953.hs (limited to 'haddock-api') diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index 12e65716..9df6acc0 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -122,12 +122,12 @@ ppTypeOrFunSig :: Bool -> LinksInfo -> SrcSpan -> [DocName] -> HsType DocNameI ppTypeOrFunSig summary links loc docnames typ (doc, argDocs) (pref1, pref2, sep) splice unicode pkg qual emptyCtxts | summary = pref1 - | Map.null argDocs = topDeclElem links loc splice docnames pref1 +++ docSection curName pkg qual doc + | Map.null argDocs = topDeclElem links loc splice docnames pref1 +++ docSection curname pkg qual doc | otherwise = topDeclElem links loc splice docnames pref2 +++ subArguments pkg qual (ppSubSigLike unicode qual typ argDocs [] sep emptyCtxts) - +++ docSection curName pkg qual doc + +++ docSection curname pkg qual doc where - curName = getName <$> listToMaybe docnames + curname = getName <$> listToMaybe docnames -- This splits up a type signature along `->` and adds docs (when they exist) to @@ -290,10 +290,11 @@ ppFamDecl :: Bool -- ^ is a summary -> Splice -> Unicode -> Maybe Package -> Qualification -> Html ppFamDecl summary associated links instances fixities loc doc decl splice unicode pkg qual | summary = ppFamHeader True associated decl unicode qual - | otherwise = header_ +++ docSection Nothing pkg qual doc +++ instancesBit + | otherwise = header_ +++ docSection curname pkg qual doc +++ instancesBit where docname = unLoc $ fdLName decl + curname = Just $ getName docname header_ = topDeclElem links loc splice [docname] $ ppFamHeader summary associated decl unicode qual <+> ppFixities fixities qual @@ -528,9 +529,11 @@ ppClassDecl summary links instances fixities loc d subdocs , tcdFDs = lfds, tcdSigs = lsigs, tcdATs = ats }) splice unicode pkg qual | summary = ppShortClassDecl summary links decl loc subdocs splice unicode pkg qual - | otherwise = classheader +++ docSection Nothing pkg qual d + | otherwise = classheader +++ docSection curname pkg qual d +++ minimalBit +++ atBit +++ methodBit +++ instancesBit where + curname = Just $ getName nm + sigs = map unLoc lsigs classheader @@ -759,10 +762,11 @@ ppDataDecl summary links instances fixities subdocs loc doc dataDecl pats splice unicode pkg qual | summary = ppShortDataDecl summary False dataDecl pats unicode qual - | otherwise = header_ +++ docSection Nothing pkg qual doc +++ constrBit +++ patternBit +++ instancesBit + | otherwise = header_ +++ docSection curname pkg qual doc +++ constrBit +++ patternBit +++ instancesBit where docname = tcdName dataDecl + curname = Just $ getName docname cons = dd_cons (tcdDataDefn dataDecl) isH98 = case unLoc (head cons) of ConDeclH98 {} -> True diff --git a/html-test/ref/Bug953.html b/html-test/ref/Bug953.html new file mode 100644 index 00000000..40b0f6a1 --- /dev/null +++ b/html-test/ref/Bug953.html @@ -0,0 +1,146 @@ +Bug953
Safe HaskellSafe

Bug953

Synopsis

Documentation

data Foo #

A foo

Examples

Expand

Foo example body

Constructors

Foo'

data Bar #

A bar

Examples

Expand

Bar example body

Constructors

Bar'
\ No newline at end of file diff --git a/html-test/src/Bug953.hs b/html-test/src/Bug953.hs new file mode 100644 index 00000000..63f2c45a --- /dev/null +++ b/html-test/src/Bug953.hs @@ -0,0 +1,17 @@ +module Bug953 where + +{- | A foo + +==== __Examples__ + +Foo example body +-} +data Foo = Foo' + +{- | A bar + +==== __Examples__ + +Bar example body +-} +data Bar = Bar' -- cgit v1.2.3