From cf7addb983bd2079b221199f8ec09c8edaeb8956 Mon Sep 17 00:00:00 2001 From: Alex Biehl Date: Fri, 23 Jun 2017 14:44:41 +0200 Subject: Lookup fixities for reexports without subordinates (#642) So we agree that reexported declarations which do not have subordinates (for example top-level functions) shouldn't have gotten fixities reexported according to the current logic. I wondered why for example Prelude.($) which is obviously reexported from GHC.Base has fixities attached (c.f. http://hackage.haskell.org/package/base-4.9.1.0/docs/Prelude.html#v:-36-). The reason is this: In mkMaps we lookup all the subordinates of top-level declarations, of course top-level functions don't have subordinates so for them the resulting list is empty. In #644 I established the invariant that there won't be any empty lists in the subordinate map. Without the patch from #642 top-level functions now started to fail reexporting their fixities. --- haddock-api/src/Haddock/Interface/AttachInstances.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'haddock-api/src/Haddock') diff --git a/haddock-api/src/Haddock/Interface/AttachInstances.hs b/haddock-api/src/Haddock/Interface/AttachInstances.hs index 527c6bcc..a2cdb752 100644 --- a/haddock-api/src/Haddock/Interface/AttachInstances.hs +++ b/haddock-api/src/Haddock/Interface/AttachInstances.hs @@ -18,6 +18,7 @@ import Haddock.Types import Haddock.Convert import Haddock.GhcUtils +import Control.Applicative import Control.Arrow hiding ((<+>)) import Data.List import Data.Ord (comparing) @@ -119,7 +120,7 @@ attachToExportItem index expInfo iface ifaceMap instIfaceMap export = } = e { expItemFixities = nubByName fst $ expItemFixities e ++ [ (n',f) | n <- getMainDeclBinder d - , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap] + , Just subs <- [instLookup instSubMap n iface ifaceMap instIfaceMap <|> Just []] , n' <- n : (subs ++ patsyn_names) , Just f <- [instLookup instFixMap n' iface ifaceMap instIfaceMap] ] } -- cgit v1.2.3