[project @ 2000-11-14 12:07:44 by simonpj]
authorsimonpj <unknown>
Tue, 14 Nov 2000 12:07:44 +0000 (12:07 +0000)
committersimonpj <unknown>
Tue, 14 Nov 2000 12:07:44 +0000 (12:07 +0000)
Fix another naming bug

ghc/compiler/basicTypes/Id.lhs
ghc/compiler/basicTypes/Name.lhs
ghc/compiler/coreSyn/CoreTidy.lhs

index 57edb62..c26f7aa 100644 (file)
@@ -23,7 +23,6 @@ module Id (
 
        -- Predicates
        omitIfaceSigForId, isDeadBinder,
-       exportWithOrigOccName,
        externallyVisibleId,
        isIP,
        isSpecPragmaId, isRecordSelector,
@@ -292,12 +291,6 @@ omitIfaceSigForId' id
                -- the instance decl
 
        other          -> False -- Don't omit!
-
--- Certain names must be exported with their original occ names, because
--- these names are bound by either a class declaration or a data declaration
--- or an explicit user export.
-exportWithOrigOccName :: Id -> Bool
-exportWithOrigOccName id = omitIfaceSigForId id || isExportedId id
 \end{code}
 
 \begin{code}
index b3a6138..1a0e155 100644 (file)
@@ -275,6 +275,9 @@ tidyTopName mod env is_exported
   = case sort of
        Global _ | is_exported -> (env, name)
                 | otherwise   -> (env, name { n_sort = new_sort })
+               -- Don't change the occurrnce names of globals, because many of them
+               -- are bound by either a class declaration or a data declaration
+               -- or an explicit user export.
 
        other    | is_exported -> (env', name { n_sort = Global mod, n_occ = occ' })
                 | otherwise   -> (env', name { n_sort = new_sort,   n_occ = occ' })
index 892cb26..e81b2a3 100644 (file)
@@ -20,7 +20,7 @@ import VarEnv
 import VarSet
 import Var             ( Id, Var )
 import Id              ( idType, idInfo, idName, isExportedId,
-                         mkVanillaId, mkId, exportWithOrigOccName,
+                         mkVanillaId, mkId, 
                          idStrictness, setIdStrictness,
                          idDemandInfo, setIdDemandInfo,
                        ) 
@@ -29,7 +29,7 @@ import IdInfo         ( specInfo, setSpecInfo,
                          workerInfo, setWorkerInfo, WorkerInfo(..)
                        )
 import Demand          ( wwLazy )
-import Name            ( getOccName, tidyTopName, mkLocalName )
+import Name            ( getOccName, tidyTopName, mkLocalName, isGlobalName )
 import OccName         ( initTidyOccEnv, tidyOccName )
 import Type            ( tidyTopType, tidyType, tidyTyVar )
 import Module          ( Module )
@@ -100,7 +100,7 @@ tidyCorePgm dflags module_name binds_in orphans_in
        -- decl.  tidyTopId then does a no-op on exported binders.
     init_tidy_env = (initTidyOccEnv avoids, emptyVarEnv)
     avoids       = [getOccName bndr | bndr <- bindersOfBinds binds_in,
-                                      exportWithOrigOccName bndr]
+                                      isGlobalName (idName bndr)]
 
 tidyBind :: Maybe Module               -- (Just m) for top level, Nothing for nested
         -> TidyEnv