[project @ 2001-01-18 11:16:08 by simonmar]
[ghc-hetmet.git] / ghc / compiler / rename / RnNames.lhs
index 5dc3100..750ffb0 100644 (file)
@@ -164,8 +164,8 @@ importsFromImportDecl this_mod_name (ImportDecl imp_mod_name from qual_only as_m
                        Just another_name -> another_name
 
        mk_prov name = NonLocalDef (UserImport imp_mod iloc (name `elemNameSet` explicits)) 
-       gbl_env      = mkGlobalRdrEnv qual_mod unqual_imp hides mk_prov filtered_avails
-       exports      = mkExportAvails qual_mod unqual_imp gbl_env       filtered_avails
+       gbl_env      = mkGlobalRdrEnv qual_mod unqual_imp True hides mk_prov filtered_avails
+       exports      = mkExportAvails qual_mod unqual_imp gbl_env            filtered_avails
     in
     returnRn (gbl_env, exports)
 \end{code}
@@ -174,7 +174,7 @@ importsFromImportDecl this_mod_name (ImportDecl imp_mod_name from qual_only as_m
 \begin{code}
 importsFromLocalDecls this_mod decls
   = mapRn (getLocalDeclBinders this_mod) decls `thenRn` \ avails_s ->
-
+       -- The avails that are returned don't include the "system" names
     let
        avails = concat avails_s
 
@@ -187,32 +187,35 @@ importsFromLocalDecls this_mod decls
        -- Check for duplicate definitions
     mapRn_ (addErrRn . dupDeclErr) dups                        `thenRn_` 
 
+
        -- Record that locally-defined things are available
     recordLocalSlurps (availsToNameSet avails)         `thenRn_`
-
     let
        mod_name   = moduleName this_mod
        unqual_imp = True       -- Want unqualified names
        mk_prov n  = LocalDef   -- Provenance is local
        hides      = []         -- Hide nothing
-       gbl_env    = mkGlobalRdrEnv mod_name unqual_imp hides mk_prov avails
-       exports    = mkExportAvails mod_name unqual_imp gbl_env       avails
+       gbl_env    = mkGlobalRdrEnv mod_name unqual_imp True hides mk_prov avails
+       exports    = mkExportAvails mod_name unqual_imp gbl_env            avails
     in
     returnRn (gbl_env, exports)
 
 ---------------------------
-getLocalDeclBinders :: Module 
-                   -> RdrNameHsDecl -> RnMG Avails
+getLocalDeclBinders :: Module -> RdrNameHsDecl -> RnMG [AvailInfo]
 getLocalDeclBinders mod (TyClD tycl_decl)
   =    -- For type and class decls, we generate Global names, with
        -- no export indicator.  They need to be global because they get
        -- permanently bound into the TyCons and Classes.  They don't need
        -- an export indicator because they are all implicitly exported.
-    getTyClDeclBinders mod tycl_decl   `thenRn` \ avail ->
+    getTyClDeclBinders mod tycl_decl   `thenRn` \ (avail, sys_names) ->
+
+       -- Record that the system names are available
+    recordLocalSlurps (mkNameSet sys_names)    `thenRn_`
     returnRn [avail]
 
 getLocalDeclBinders mod (ValD binds)
-  = mapRn new (bagToList (collectTopBinders binds))
+  = mapRn new (bagToList (collectTopBinders binds))    `thenRn` \ avails ->
+    returnRn avails
   where
     new (rdr_name, loc) = newTopBinder mod rdr_name loc        `thenRn` \ name ->
                          returnRn (Avail name)