[commit: ghc] supercompiler: Change lookupIdSubst to rename global variables if a mapping is available (5a51410)

Max Bolingbroke <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : supercompiler

http://hackage.haskell.org/trac/ghc/changeset/5a5141018ec6d0629fc1aa0373941abd2683772b

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

commit 5a5141018ec6d0629fc1aa0373941abd2683772b
Author: Max Bolingbroke <[email protected]>
Date:   Tue Mar 20 15:27:25 2012 +0000

    Change lookupIdSubst to rename global variables if a mapping is available

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

 compiler/coreSyn/CoreSubst.lhs |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/compiler/coreSyn/CoreSubst.lhs b/compiler/coreSyn/CoreSubst.lhs
index 16173fb..96f0a2b 100644
--- a/compiler/coreSyn/CoreSubst.lhs
+++ b/compiler/coreSyn/CoreSubst.lhs
@@ -265,12 +265,11 @@ extendSubstList subst ((var,rhs):prs) = extendSubstList (extendSubst subst var r
 -- | Find the substitution for an 'Id' in the 'Subst'
 lookupIdSubst :: SDoc -> Subst -> Id -> CoreExpr
 lookupIdSubst doc (Subst in_scope ids _ _) v
-  | not (isLocalId v) = Var v
   | Just e  <- lookupVarEnv ids       v = e
   | Just v' <- lookupInScope in_scope v = Var v'
 	-- Vital! See Note [Extending the Subst]
-  | otherwise = WARN( True, ptext (sLit "CoreSubst.lookupIdSubst") <+> doc <+> ppr v 
-                            $$ ppr in_scope) 
+  | otherwise = WARN( isLocalId v, ptext (sLit "CoreSubst.lookupIdSubst") <+> doc <+> ppr v 
+                                   $$ ppr in_scope) 
 		Var v
 
 -- | Find the substitution for a 'TyVar' in the 'Subst'
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.