[commit: haddock] ghc-head, ghc-head1, headdock-library-1.4.5, ie_avails, master, pr/cabal-desc, v2.18, wip/T14529, wip/revert-ttg-2017-11-20, wip/ttg-2017-10-13, wip/ttg-2017-10-31, wip/ttg-2017-11-06, wip/ttg2-2017-11-10, wip/ttg3-2017-11-12, wip/ttg4-constraints-2017-11-13, wip/ttg6-unrevert-2017-11-22: Fix haddock: internal error: links: UnhelpfulSpan (#561) (901b327)

git at git.haskell.org git at git.haskell.org
Tue Nov 28 11:52:49 UTC 2017


Repository : ssh://git@git.haskell.org/haddock

On branches: ghc-head,ghc-head1,headdock-library-1.4.5,ie_avails,master,pr/cabal-desc,v2.18,wip/T14529,wip/revert-ttg-2017-11-20,wip/ttg-2017-10-13,wip/ttg-2017-10-31,wip/ttg-2017-11-06,wip/ttg2-2017-11-10,wip/ttg3-2017-11-12,wip/ttg4-constraints-2017-11-13,wip/ttg6-unrevert-2017-11-22
Link       : http://git.haskell.org/haddock.git/commitdiff/901b327f46dc4bd70cd310ae2c6339aa9ce572bb

>---------------------------------------------------------------

commit 901b327f46dc4bd70cd310ae2c6339aa9ce572bb
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Sun Jul 2 11:12:01 2017 +0100

    Fix haddock: internal error: links: UnhelpfulSpan (#561)
    
    * Fix haddock: internal error: links: UnhelpfulSpan
    
    This fixes #554 for me. I believe this is another fall out
    of `wildcard-refactor`, like #549.
    
    * Comment to clarify why we take the methods name location


>---------------------------------------------------------------

901b327f46dc4bd70cd310ae2c6339aa9ce572bb
 haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 6 ++++--
 haddock-api/src/Haddock/Convert.hs             | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
index 716050f..cda0611 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
@@ -635,8 +635,10 @@ ppInstanceSigs :: LinksInfo -> Splice -> Unicode -> Qualification
 ppInstanceSigs links splice unicode qual sigs = do
     TypeSig lnames typ <- sigs
     let names = map unLoc lnames
-        L loc rtyp = hsSigWcType typ
-    return $ ppSimpleSig links splice unicode qual loc names rtyp
+        L _ rtyp = hsSigWcType typ
+    -- Instance methods signatures are synified and thus don't have a useful 
+    -- SrcSpan value. Use the methods name location instead.
+    return $ ppSimpleSig links splice unicode qual (getLoc $ head $ lnames) names rtyp
 
 
 lookupAnySubdoc :: Eq id1 => id1 -> [(id1, DocForDecl id2)] -> DocForDecl id2
diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs
index 577b1a3..4aaaed9 100644
--- a/haddock-api/src/Haddock/Convert.hs
+++ b/haddock-api/src/Haddock/Convert.hs
@@ -29,7 +29,7 @@ import Name
 import NameSet ( emptyNameSet )
 import RdrName ( mkVarUnqual )
 import PatSyn
-import SrcLoc ( Located, noLoc, unLoc )
+import SrcLoc ( Located, noLoc, unLoc, GenLocated(..), srcLocSpan )
 import TcType ( tcSplitSigmaTy )
 import TyCon
 import Type
@@ -318,7 +318,7 @@ synifyDataCon use_gadt_syntax dc =
                          , con_doc =  Nothing }
 
 synifyName :: NamedThing n => n -> Located Name
-synifyName = noLoc . getName
+synifyName n = L (srcLocSpan (getSrcLoc n)) (getName n)
 
 
 synifyIdSig :: SynifyTypeState -> Id -> Sig Name



More information about the ghc-commits mailing list