[project @ 2001-12-06 14:42:56 by simonmar]
authorsimonmar <unknown>
Thu, 6 Dec 2001 14:42:56 +0000 (14:42 +0000)
committersimonmar <unknown>
Thu, 6 Dec 2001 14:42:56 +0000 (14:42 +0000)
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

index 344a5db..f8842b9 100644 (file)
@@ -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}