[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/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: Fix logic behind binder type renaming. (2c94f5a)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 20:50:21 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/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
Link       : http://git.haskell.org/haddock.git/commitdiff/2c94f5a7804ecf84f818a64ba41ca5829621323c

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

commit 2c94f5a7804ecf84f818a64ba41ca5829621323c
Author: Ɓukasz Hanuszczak <lukasz.hanuszczak at gmail.com>
Date:   Sun Jul 19 15:57:10 2015 +0200

    Fix logic behind binder type renaming.


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

2c94f5a7804ecf84f818a64ba41ca5829621323c
 haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
index a9c4646..6a14971 100644
--- a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
+++ b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs
@@ -193,9 +193,11 @@ renameLTyOp (wrap, lname) = (,) wrap <$> located renameName lname
 renameNameBndr :: SetName name => name -> Rename name name
 renameNameBndr name = do
     fv <- ask
-    when (getOccName name `Set.member` fv) $
-        freshName name
-    renameName name
+    env <- get
+    case Map.lookup (getName name) env of
+        Just name' -> pure name'
+        Nothing | getOccName name `Set.member` fv -> freshName name
+        Nothing -> pure name
 
 
 renameName :: SetName name => name -> Rename name name
@@ -206,13 +208,14 @@ renameName name = do
         Nothing -> name
 
 
-freshName :: SetName name => name -> Rename name ()
+freshName :: SetName name => name -> Rename name name
 freshName name = do
     fv <- ask
     env <- get
     let taken = Set.union fv (Set.fromList . map getOccName . Map.keys $ env)
     let name' = setInternalOccName (findFreshName taken occ) name
     put $ Map.insert nname name' env
+    return name'
   where
     nname = getName name
     occ = nameOccName nname



More information about the ghc-commits mailing list