From b1c3d11ac8c6841fa785e016cb602a1ea4aa7705 Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 6 Dec 2001 14:42:56 +0000 Subject: [PATCH] [project @ 2001-12-06 14:42:56 by simonmar] Turn a lazy pattern match into a strict one in tidyIdBndr. This prevents us accidentally hanging onto stuff in the OccName field of a Name after tidying. --- ghc/compiler/coreSyn/CoreTidy.lhs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/coreSyn/CoreTidy.lhs b/ghc/compiler/coreSyn/CoreTidy.lhs index 344a5db..f8842b9 100644 --- a/ghc/compiler/coreSyn/CoreTidy.lhs +++ b/ghc/compiler/coreSyn/CoreTidy.lhs @@ -670,9 +670,12 @@ tidyLetBndr env (id,rhs) -- so it gets propagated to the usage sites. new_var_env = extendVarEnv var_env id final_id +-- Non-top-level variables tidyIdBndr :: TidyEnv -> Id -> (TidyEnv, Id) tidyIdBndr env@(tidy_env, var_env) id - = -- Non-top-level variables + = -- do this pattern match strictly, otherwise we end up holding on to + -- stuff in the OccName. + case tidyOccName tidy_env (getOccName id) of { (tidy_env', occ') -> let -- Give the Id a fresh print-name, *and* rename its type -- The SrcLoc isn't important now, @@ -680,12 +683,12 @@ tidyIdBndr env@(tidy_env, var_env) id -- -- All nested Ids now have the same IdInfo, namely none, -- which should save some space. - (tidy_env', occ') = tidyOccName tidy_env (getOccName id) ty' = tidyType env (idType id) id' = mkUserLocal occ' (idUnique id) ty' noSrcLoc var_env' = extendVarEnv var_env id id' in ((tidy_env', var_env'), id') + } \end{code} \begin{code} -- 1.7.10.4