[commit: haddock] 2.17.3.1-spanfix, alexbiehl-patch-1, ghc-8.0, ghc-8.0-facebook, ghc-head, ghc-head1, haddock-quick, headdock-library-1.4.5, ie_avails, issue-303, issue-475, master, pr-filter-maps, pr/cabal-desc, travis, v2.16, v2.17, v2.17.3, v2.18, wip-located-module-as, wip/D2418, wip/T11080-open-data-kinds, wip/T11258, wip/T11430, wip/T12105, wip/T12105-2, wip/T12942, wip/T13163, wip/T14529, wip/T3384, wip/embelleshed-rdr, wip/new-tree-one-param, wip/rae, wip/remove-frames, wip/remove-frames1, 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 yet another renamer bug where some names were not unique. (fb62902)

git at git.haskell.org git at git.haskell.org
Tue Nov 28 11:35:24 UTC 2017


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

On branches: 2.17.3.1-spanfix,alexbiehl-patch-1,ghc-8.0,ghc-8.0-facebook,ghc-head,ghc-head1,haddock-quick,headdock-library-1.4.5,ie_avails,issue-303,issue-475,master,pr-filter-maps,pr/cabal-desc,travis,v2.16,v2.17,v2.17.3,v2.18,wip-located-module-as,wip/D2418,wip/T11080-open-data-kinds,wip/T11258,wip/T11430,wip/T12105,wip/T12105-2,wip/T12942,wip/T13163,wip/T14529,wip/T3384,wip/embelleshed-rdr,wip/new-tree-one-param,wip/rae,wip/remove-frames,wip/remove-frames1,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/fb62902d37e9467364bbbafc9e06128be89a7277

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

commit fb62902d37e9467364bbbafc9e06128be89a7277
Author: Ɓukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Fri Jul 24 19:32:22 2015 +0200

    Fix yet another renamer bug where some names were not unique.


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

fb62902d37e9467364bbbafc9e06128be89a7277
 haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
index 38ec7d4..a8a4e8e 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
@@ -296,9 +296,10 @@ rebindTyVarBndr (KindedTyVar name kinds) =
 rebindName :: SetName name => name -> Rebind name name
 rebindName name = do
     RenameEnv { .. } <- get
+    taken <- takenNames
     case Map.lookup (getName name) rneCtx of
         Just name' -> pure name'
-        Nothing | getNameRep name `Set.member` rneFV -> freshName name
+        Nothing | getNameRep name `Set.member` taken -> freshName name
         Nothing -> reuseName name
 
 
@@ -306,12 +307,11 @@ rebindName name = do
 freshName :: SetName name => name -> Rebind name name
 freshName name = do
     env at RenameEnv { .. } <- get
-    let taken = Set.union rneFV (elems' rneCtx)
+    taken <- takenNames
     let name' = setInternalNameRep (findFreshName taken rep) name
     put $ env { rneCtx = Map.insert nname name' rneCtx }
     return name'
   where
-    elems' = Set.fromList . map getNameRep . Map.elems
     nname = getName name
     rep = getNameRep nname
 
@@ -323,6 +323,14 @@ reuseName name = do
     return name
 
 
+takenNames :: NamedThing name => Rebind name (Set NameRep)
+takenNames = do
+    RenameEnv { .. } <- get
+    return $ Set.union rneFV (ctxElems rneCtx)
+  where
+    ctxElems = Set.fromList . map getNameRep . Map.elems
+
+
 findFreshName :: Set NameRep -> NameRep -> NameRep
 findFreshName taken =
     fromJust . List.find isFresh . alternativeNames



More information about the ghc-commits mailing list