[project @ 2000-09-22 15:56:12 by simonpj]
[ghc-hetmet.git] / ghc / compiler / rename / Rename.lhs
index 0f9fe08..1ffe1f7 100644 (file)
@@ -161,10 +161,14 @@ rename this_mod@(HsModule mod_name vers exports imports local_decls mod_deprec l
     getIfacesRn                        `thenRn` \ ifaces ->
     let
        direct_import_mods :: [Module]
-       direct_import_mods = [m | (_, _, Just (m, _, _, _, ImportByUser, _))
-                                 <- eltsFM (iImpModInfo ifaces)]
-               -- Pick just the non-back-edge imports
-               -- (Back edges are ImportByUserSource)
+       direct_import_mods = [m | (_, _, Just (m, _, _, _, imp, _))
+                                 <- eltsFM (iImpModInfo ifaces), user_import imp]
+
+               -- *don't* just pick the forward edges.  It's entirely possible
+               -- that a module is only reachable via back edges.
+       user_import ImportByUser = True
+       user_import ImportByUserSource = True
+       user_import _ = False
 
        this_module        = mkThisModule mod_name
 
@@ -271,6 +275,7 @@ isOrphanDecl (RuleD (HsRule _ _ _ lhs _ _))
     check (HsVar v)      = not (isLocallyDefined v)
     check (HsApp f a)    = check f && check a
     check (HsLit _)      = False
+    check (HsOverLit _)          = False
     check (OpApp l o _ r) = check l && check o && check r
     check (NegApp e _)    = check e
     check (HsPar e)      = check e
@@ -544,7 +549,6 @@ getGates source_fvs (TyClD (TyData _ ctxt tycon tvs cons _ _ _ _))
     get_details (VanillaCon tys) = plusFVs (map get_bang tys)
     get_details (InfixCon t1 t2) = get_bang t1 `plusFV` get_bang t2
     get_details (RecCon fields)  = plusFVs [get_bang t | (_, t) <- fields]
-    get_details (NewCon t _)    = extractHsTyNames t
 
     get_field (fs,t) | any (`elemNameSet` source_fvs) fs = get_bang t
                     | otherwise                         = emptyFVs
@@ -760,8 +764,9 @@ reportUnusedNames mod_name direct_import_mods
 
        -- unused_imp_mods are the directly-imported modules 
        -- that are not mentioned in minimal_imports
-       unused_imp_mods = [m | m <- direct_import_mods, 
-                               not (maybeToBool (lookupFM minimal_imports m))]
+       unused_imp_mods = [m | m <- direct_import_mods,
+                              not (maybeToBool (lookupFM minimal_imports m)),
+                              moduleName m /= pRELUDE_Name]
 
        module_unused :: Name -> Bool
        -- Name is imported from a module that's completely unused,