import TcTyClsDecls ( tcTyAndClassDecls )
import LoadIface ( loadOrphanModules )
import RnNames ( importsFromLocalDecls, rnImports, exportsFromAvail,
import TcTyClsDecls ( tcTyAndClassDecls )
import LoadIface ( loadOrphanModules )
import RnNames ( importsFromLocalDecls, rnImports, exportsFromAvail,
import RnEnv ( lookupSrcOcc_maybe )
import RnSource ( rnSrcDecls, rnTyClDecls, checkModDeprec )
import PprCore ( pprIdRules, pprCoreBindings )
import CoreSyn ( IdCoreRule, bindersOfBinds )
import ErrUtils ( mkDumpDoc, showPass )
import RnEnv ( lookupSrcOcc_maybe )
import RnSource ( rnSrcDecls, rnTyClDecls, checkModDeprec )
import PprCore ( pprIdRules, pprCoreBindings )
import CoreSyn ( IdCoreRule, bindersOfBinds )
import ErrUtils ( mkDumpDoc, showPass )
-import Id ( mkLocalId, isLocalId, idName, idType, setIdLocalExported )
+import Id ( mkExportedLocalId, isLocalId, idName, idType )
import Var ( Var )
import Module ( mkHomeModule, mkModuleName, moduleName, moduleEnvElts )
import OccName ( mkVarOcc )
import Var ( Var )
import Module ( mkHomeModule, mkModuleName, moduleName, moduleEnvElts )
import OccName ( mkVarOcc )
import TysWiredIn ( mkListTy, unitTy )
import IdInfo ( GlobalIdDetails(..) )
import SrcLoc ( interactiveSrcLoc, unLoc )
import TysWiredIn ( mkListTy, unitTy )
import IdInfo ( GlobalIdDetails(..) )
import SrcLoc ( interactiveSrcLoc, unLoc )
import Name ( nameOccName, nameModuleName )
import NameEnv ( delListFromNameEnv )
import PrelNames ( iNTERACTIVE, ioTyConName, printName, monadNames, itName, returnIOName )
import Name ( nameOccName, nameModuleName )
import NameEnv ( delListFromNameEnv )
import PrelNames ( iNTERACTIVE, ioTyConName, printName, monadNames, itName, returnIOName )
+ -- Report the use of any deprecated things
+ -- We do this before processsing the export list so
+ -- that we don't bleat about re-exporting a deprecated
+ -- thing (especially via 'module Foo' export item)
+ -- Only uses in the body of the module are complained about
+ reportDeprecations tcg_env ;
+
-- Get any supporting decls for the exports that have not already
-- been sucked in for the declarations in the body of the module.
-- (This can happen if something is imported only to be re-exported.)
-- Get any supporting decls for the exports that have not already
-- been sucked in for the declarations in the body of the module.
-- (This can happen if something is imported only to be re-exported.)
-- We don't need the results, but sucking them in may side-effect
-- the ExternalPackageState, apart from recording usage
mappM (tcLookupGlobal . availName) export_avails ;
-- We don't need the results, but sucking them in may side-effect
-- the ExternalPackageState, apart from recording usage
mappM (tcLookupGlobal . availName) export_avails ;
-- Check whether the entire module is deprecated
-- This happens only once per module
let { mod_deprecs = checkModDeprec mod_deprec } ;
-- Add exports and deprecations to envt
-- Check whether the entire module is deprecated
-- This happens only once per module
let { mod_deprecs = checkModDeprec mod_deprec } ;
-- Add exports and deprecations to envt
- let { export_fvs = availsToNameSet export_avails ;
- final_env = tcg_env { tcg_exports = export_avails,
- tcg_dus = tcg_dus tcg_env `plusDU` usesOnly export_fvs,
+ let { final_env = tcg_env { tcg_exports = exports,
+ tcg_dus = tcg_dus tcg_env `plusDU` usesOnly exports,
-- important: otherwise when we come to compile an expression
-- using these ids later, the byte code generator will consider
-- the occurrences to be free rather than global.
-- important: otherwise when we come to compile an expression
-- using these ids later, the byte code generator will consider
-- the occurrences to be free rather than global.
-- ToDo: export the data types also?
final_type_env = extendTypeEnvWithIds (tcg_type_env tcg_env) bndrs ;
-- ToDo: export the data types also?
final_type_env = extendTypeEnvWithIds (tcg_type_env tcg_env) bndrs ;
- ; let { gres = [ GRE { gre_name = name, gre_prov = vanillaProv mod,
- gre_deprec = mi_dep_fn iface name }
+ ; let { gres = [ GRE { gre_name = name, gre_prov = vanillaProv mod }
| avail <- avails, name <- availNames avail ] }
; returnM (mkGlobalRdrEnv gres) }
| avail <- avails, name <- availNames avail ] }
; returnM (mkGlobalRdrEnv gres) }
main_bind = noLoc (VarBind root_main_id main_expr) }
; return (tcg_env { tcg_binds = tcg_binds tcg_env
main_bind = noLoc (VarBind root_main_id main_expr) }
; return (tcg_env { tcg_binds = tcg_binds tcg_env