aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2016-05-22 12:42:23 +0200
committerBen Gamari <ben@smart-cactus.org>2016-05-22 12:43:59 +0200
commit6193f6d07f380436048928182ef511f167909a53 (patch)
tree98d0ed3775695445d09b419b72cf00daca4e36b6
parentc03dad1c5d4ab7c44234d145ba9c13f17a918201 (diff)
Don't consider default class ops when looking for decls
When we are looking for an operation within a class we don't care about `default`-type declarations. This was the cause of #505.
-rw-r--r--haddock-api/src/Haddock/Interface/Create.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs
index 8d561d68..e0b52cb5 100644
--- a/haddock-api/src/Haddock/Interface/Create.hs
+++ b/haddock-api/src/Haddock/Interface/Create.hs
@@ -783,8 +783,13 @@ extractDecl name mdl decl
| otherwise =
case unLoc decl of
TyClD d@ClassDecl {} ->
- let matches = [ sig | sig <- tcdSigs d, name `elem` sigName sig,
- isTypeLSig sig ] -- TODO: document fixity
+ let matches = [ lsig
+ | lsig <- tcdSigs d
+ , ClassOpSig False _ _ <- pure $ unLoc lsig
+ -- Note: exclude `default` declarations (see #505)
+ , name `elem` sigName lsig
+ ]
+ -- TODO: document fixity
in case matches of
[s0] -> let (n, tyvar_names) = (tcdName d, tyClDeclTyVars d)
L pos sig = addClassContext n tyvar_names s0