[commit: ghc] : Do not externalise non-Ids (043abae)

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  : 

http://hackage.haskell.org/trac/ghc/changeset/043abaeb00e351975116ea428d38cc5b1dfeaaa8

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

commit 043abaeb00e351975116ea428d38cc5b1dfeaaa8
Author: Max Bolingbroke <[email protected]>
Date:   Tue Jan 3 13:59:46 2012 +0000

    Do not externalise non-Ids

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

 compiler/supercompile/Supercompile.hs              |    6 +++---
 .../supercompile/Supercompile/Drive/Process.hs     |    6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/compiler/supercompile/Supercompile.hs b/compiler/supercompile/Supercompile.hs
index 00f58f4..60d601d 100644
--- a/compiler/supercompile/Supercompile.hs
+++ b/compiler/supercompile/Supercompile.hs
@@ -265,12 +265,12 @@ coreBindsToCoreTerm should_sc binds
     -- unique and b) the internality of these names will be carried down on the next simplifier run, so this works.
     -- The ice is thin, though!
     sc_xs = bindersOfBinds sc_binds
-    internal_sc_binds = [case bind of NonRec x e -> NonRec (localiseVar x) e
-                                      Rec xes    -> Rec (map (first localiseVar) xes)
+    internal_sc_binds = [case bind of NonRec x e -> NonRec (localiseInternaliseId x) e
+                                      Rec xes    -> Rec (map (first localiseInternaliseId) xes)
                         | bind <- sc_binds]
     sc_xs_internal_xs = filter (\(x, _) -> isExportedId x || x `elemVarSet` dont_sc_binds_fvs) (sc_xs `zip` bindersOfBinds internal_sc_binds)
     sc_internal_xs = map snd sc_xs_internal_xs
-    localiseVar x = setIdNotExported (x `setVarName` localiseName (varName x))
+    localiseInternaliseId x = setIdNotExported (x `setVarName` localiseName (varName x))
      -- If we don't mark these Ids as not exported then we get lots of residual top-level bindings of the form x = y
 
 mkChurchVarTup :: [Id] -> CoreExpr
diff --git a/compiler/supercompile/Supercompile/Drive/Process.hs b/compiler/supercompile/Supercompile/Drive/Process.hs
index af20b89..f951d0e 100644
--- a/compiler/supercompile/Supercompile/Drive/Process.hs
+++ b/compiler/supercompile/Supercompile/Drive/Process.hs
@@ -465,7 +465,11 @@ renameAbsVar rn (AbsVar { absVarDead = dead, absVarVar = x })
 -- us from lambda-abstracting over them. However, it can happen if the global is abstracted due to generalisation,
 -- such as when the let-bound thing binds a (:) and we generalise away some other (:).
 absVarBinder :: AbsVar -> Var
-absVarBinder = localiseId . absVarVar
+absVarBinder = localiseVar . absVarVar
+
+localiseVar :: Var -> Var
+localiseVar x | isId x    = localiseId x
+              | otherwise = x
 
 absVarLambdas :: Symantics ann => [AbsVar] -> ann (TermF ann) -> ann (TermF ann)
 absVarLambdas xs = tyVarIdLambdas (map absVarBinder xs)
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.