Only look up whether a module's SOURCE-imported if it's in the current package
authorIan Lynagh <igloo@earth.li>
Thu, 13 Aug 2009 16:24:35 +0000 (16:24 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 13 Aug 2009 16:24:35 +0000 (16:24 +0000)
Suppose we import anotherPackage:M, which exports things from
anotherPackage:Internal. Then GHC will want to read
anotherPackage:Internal.hi.

However, if we have also SOURCE-imported thisPackage:Internal then
we don't want GHC to try to read anotherPackage:Internal.hi-boot
instead.

The mapping that tells us whether a module is SOURCE-imported uses just
the module name for the key, so we have to check the package ID before
looking it up.

Fixes #3007.

compiler/iface/LoadIface.lhs

index 1412b00..1a3c0cb 100644 (file)
@@ -191,9 +191,11 @@ loadInterface doc_str mod from
                        -- if an earlier import had a before we got to real imports.   I think.
            _ -> do {
 
-          let { hi_boot_file = case from of
-                               ImportByUser usr_boot -> usr_boot
-                               ImportBySystem        -> sys_boot
+          let { hi_boot_file = if thisPackage dflags == modulePackageId mod
+                               then case from of
+                                    ImportByUser usr_boot -> usr_boot
+                                    ImportBySystem        -> sys_boot
+                               else False
 
              ; mb_dep   = lookupUFM (eps_is_boot eps) (moduleName mod)
              ; sys_boot = case mb_dep of