aboutsummaryrefslogtreecommitdiff
path: root/haddock-api
diff options
context:
space:
mode:
authorƁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-07-24 18:40:48 +0200
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2015-08-21 18:22:32 +0100
commita66852d67fa3a035eaa255880fb82f6f499d7e39 (patch)
tree9f3a826f35f502e67d3ad3a3ab846b3cfdecbf28 /haddock-api
parent131e5835425e1e411ceb5cb73f9dee855b702053 (diff)
Fix another type renamer bug where not all names were rebound.
Diffstat (limited to 'haddock-api')
-rw-r--r--haddock-api/src/Haddock/Backends/Xhtml/Specialize.hs9
1 files changed, 8 insertions, 1 deletions
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