From 4f249c9b64d50d79e7ba703289cd67293a76821a Mon Sep 17 00:00:00 2001 From: Richard Eisenberg Date: Fri, 10 Mar 2017 11:31:33 -0500 Subject: Update Haddock w.r.t. new HsImplicitBndrs --- haddock-api/src/Haddock/Convert.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'haddock-api/src/Haddock/Convert.hs') diff --git a/haddock-api/src/Haddock/Convert.hs b/haddock-api/src/Haddock/Convert.hs index b5966291..577b1a3c 100644 --- a/haddock-api/src/Haddock/Convert.hs +++ b/haddock-api/src/Haddock/Convert.hs @@ -114,7 +114,8 @@ synifyAxBranch tc (CoAxBranch { cab_tvs = tkvs, cab_lhs = args, cab_rhs = rhs }) hs_rhs = synifyType WithinType rhs in TyFamEqn { tfe_tycon = name , tfe_pats = HsIB { hsib_body = typats - , hsib_vars = map tyVarName tkvs } + , hsib_vars = map tyVarName tkvs + , hsib_closed = True } , tfe_fixity = Prefix , tfe_rhs = hs_rhs } @@ -300,7 +301,7 @@ synifyDataCon use_gadt_syntax dc = (False,True) -> case linear_tys of [a,b] -> return $ InfixCon a b _ -> Left "synifyDataCon: infix with non-2 args?" - gadt_ty = HsIB [] (synifyType WithinType res_ty) + gadt_ty = HsIB [] (synifyType WithinType res_ty) False -- finally we get synifyDataCon's result! in hs_arg_tys >>= \hat -> -- cgit v1.2.3 From 901b327f46dc4bd70cd310ae2c6339aa9ce572bb Mon Sep 17 00:00:00 2001 From: Bartosz Nitka Date: Sun, 2 Jul 2017 11:12:01 +0100 Subject: 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 --- haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 6 ++++-- haddock-api/src/Haddock/Convert.hs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'haddock-api/src/Haddock/Convert.hs') diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index 716050fa..cda0611a 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 577b1a3c..4aaaed9d 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 -- cgit v1.2.3