compiled:
import B <n> ;
to record the fact that A does import B indirectly. This is used to decide
-to look to look for B.hi rather than B.hi-boot when compiling a module that
+to look for B.hi rather than B.hi-boot when compiling a module that
imports A. This line says that A imports B, but uses nothing in it.
So we'll get an early bale-out when compiling A if B's version changes.
haul in all the unfoldings for B, in case the module that imports A *is*
compiled with -O. I think this is the case.]
+SimonM [30/11/2007]: I believe the above is all out of date; the
+current implementation doesn't do it this way. Instead, when any of
+the dependencies of a declaration changes, the version of the
+declaration itself changes.
\begin{code}
#include "HsVersions.h"
-- return True if an external name has changed
name_changed :: Name -> Bool
name_changed nm
- | Just ents <- lookupUFM usg_modmap (moduleName mod)
- = case lookupUFM ents parent_occ of
- Nothing -> pprPanic "computeChangedOccs" (ppr nm)
- Just v -> v < new_version
+ | Just ents <- lookupUFM usg_modmap (moduleName mod),
+ Just v <- lookupUFM ents parent_occ
+ = v < new_version
+ | modulePackageId mod == this_pkg
+ = WARN(True, ptext SLIT("computeChangedOccs") <+> ppr nm) True
+ -- should really be a panic, see #1959. The problem is that the usages doesn't
+ -- contain all the names that might be referred to by unfoldings. So as a
+ -- conservative workaround we just assume these names have changed.
| otherwise = False -- must be in another package
where
mod = nameModule nm
(parent_occ, new_version) = ver_fn nm
+ this_pkg = modulePackageId this_module
+
-- Turn the usages from the old ModIface into a mapping
- usg_modmap = listToUFM [ (usg_mod usg, listToUFM (usg_entities usg))
+ usg_modmap = listToUFM [ (usg_name usg, listToUFM (usg_entities usg))
| usg <- old_usages ]
get_local_eq_info :: GenIfaceEq NameSet -> GenIfaceEq OccSet
type OccIfaceEq = GenIfaceEq OccSet
+instance Outputable OccIfaceEq where
+ ppr Equal = ptext SLIT("Equal")
+ ppr NotEqual = ptext SLIT("NotEqual")
+ ppr (EqBut occset) = ptext SLIT("EqBut") <+> ppr (occSetElts occset)
+
changedWrt :: OccSet -> OccIfaceEq -> Bool
changedWrt so_far Equal = False
changedWrt so_far NotEqual = True