FIX #1650: ".boot modules interact badly with the ghci debugger"
[ghc-hetmet.git] / compiler / main / TidyPgm.lhs
index 6b89b33..8dabe4e 100644 (file)
@@ -4,6 +4,13 @@
 \section{Tidying up Core}
 
 \begin{code}
+{-# OPTIONS -w #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+--     http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
+
 module TidyPgm( mkBootModDetails, tidyProgram ) where
 
 #include "HsVersions.h"
@@ -28,11 +35,8 @@ import IdInfo                {- loads of stuff -}
 import InstEnv         ( Instance, DFunId, instanceDFunId, setInstanceDFunId )
 import NewDemand       ( isBottomingSig, topSig )
 import BasicTypes      ( Arity, isNeverActive, isNonRuleLoopBreaker )
-import Name            ( Name, getOccName, nameOccName, mkInternalName,
-                         localiseName, isExternalName, nameSrcLoc,
-                         isWiredInName, getName
-                       )
-import NameSet         ( NameSet, elemNameSet, filterNameSet )
+import Name
+import NameSet         ( NameSet, elemNameSet )
 import IfaceEnv                ( allocateGlobalBinder )
 import NameEnv         ( filterNameEnv, mapNameEnv )
 import OccName         ( TidyOccEnv, initTidyOccEnv, tidyOccName )
@@ -141,7 +145,6 @@ mkBootModDetails hsc_env (ModGuts { mg_module    = mod
                             , md_fam_insts = fam_insts
                             , md_rules     = []
                             , md_exports   = exports
-                             , md_modBreaks = modBreaks 
                              , md_vect_info = noVectInfo
                              })
        }
@@ -287,12 +290,6 @@ tidyProgram hsc_env
              ; implicit_binds = getImplicitBinds type_env
              ; all_tidy_binds = implicit_binds ++ tidy_binds
              ; alg_tycons = filter isAlgTyCon (typeEnvTyCons type_env)
-
-              ; tidy_vect_info = VectInfo 
-                                   (filterNameSet (isElemId type_env) 
-                                                  (vectInfoCCVar vect_info))
-                -- filter against `type_env', not `tidy_type_env', as we must
-                -- keep all implicit names
              }
 
        ; endPass dflags "Tidy Core" Opt_D_dump_simpl all_tidy_binds
@@ -306,15 +303,15 @@ tidyProgram hsc_env
                           cg_dir_imps = dir_imps,
                           cg_foreign  = foreign_stubs,
                           cg_dep_pkgs = dep_pkgs deps,
-                          cg_hpc_info = hpc_info }, 
+                          cg_hpc_info = hpc_info,
+                           cg_modBreaks = modBreaks }, 
 
                   ModDetails { md_types     = tidy_type_env,
                                md_rules     = tidy_rules,
                                md_insts     = tidy_insts,
                                md_fam_insts = fam_insts,
                                md_exports   = exports,
-                                md_modBreaks = modBreaks,
-                                md_vect_info = tidy_vect_info
+                                md_vect_info = vect_info    -- is already tidy
                               })
        }
 
@@ -323,11 +320,6 @@ lookup_dfun type_env dfun_id
        Just (AnId dfun_id') -> dfun_id'
        other -> pprPanic "lookup_dfun" (ppr dfun_id)
 
-isElemId type_env name
-  = case lookupTypeEnv type_env name of
-       Just (AnId _) -> True
-       _             -> False
-
 tidyTypeEnv :: Bool -> NameSet -> TypeEnv -> [CoreBind] -> TypeEnv
 
 -- The competed type environment is gotten from
@@ -685,7 +677,7 @@ tidyTopName mod nc_var ext_ids occ_env id
     global     = isExternalName name
     local      = not global
     internal   = not external
-    loc                = nameSrcLoc name
+    loc                = nameSrcSpan name
 
     (occ_env', occ') = tidyOccName occ_env (nameOccName name)