-- Predicates
omitIfaceSigForId, isDeadBinder,
- exportWithOrigOccName,
externallyVisibleId,
isIP,
isSpecPragmaId, isRecordSelector,
-- 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}
= 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' })
import VarSet
import Var ( Id, Var )
import Id ( idType, idInfo, idName, isExportedId,
- mkVanillaId, mkId, exportWithOrigOccName,
+ mkVanillaId, mkId,
idStrictness, setIdStrictness,
idDemandInfo, setIdDemandInfo,
)
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 )
-- 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