[project @ 2000-08-16 13:28:25 by simonmar]
authorsimonmar <unknown>
Wed, 16 Aug 2000 13:28:25 +0000 (13:28 +0000)
committersimonmar <unknown>
Wed, 16 Aug 2000 13:28:25 +0000 (13:28 +0000)
Don't just pick the back edges ({-# SOURCE #-} imports) when
collecting the list of imports for module initialisation.  It's
entirely possible that a module is only reachable from Main via {-#
SOURCE #-} imports.

ghc/compiler/rename/Rename.lhs

index 0f9fe08..68ac301 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