From a66852d67fa3a035eaa255880fb82f6f499d7e39 Mon Sep 17 00:00:00 2001 From: Ɓukasz Hanuszczak Date: Fri, 24 Jul 2015 18:40:48 +0200 Subject: Fix another type renamer bug where not all names were rebound. --- haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'haddock-api/src/Haddock/Backends') diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs index 78af98b8..38ec7d44 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs @@ -299,7 +299,7 @@ rebindName name = do case Map.lookup (getName name) rneCtx of Just name' -> pure name' Nothing | getNameRep name `Set.member` rneFV -> freshName name - Nothing -> pure name + Nothing -> reuseName name -- | Generate fresh occurrence name, put it into context and return. @@ -316,6 +316,13 @@ freshName name = do rep = getNameRep nname +reuseName :: SetName name => name -> Rebind name name +reuseName name = do + env@RenameEnv { .. } <- get + put $ env { rneCtx = Map.insert (getName name) name rneCtx } + return name + + findFreshName :: Set NameRep -> NameRep -> NameRep findFreshName taken = fromJust . List.find isFresh . alternativeNames -- cgit v1.2.3