- -- For (a) library modules
- -- (b) source-imported modules
- -- we do something special. We don't want to record detailed usage information.
- -- Indeed we don't want to record them at all unless they contain orphans,
- -- which we must never lose track of.
- mk_version_info mod_name (version, has_orphans, cts) so_far
- | lib_or_source_imported && not has_orphans
- = so_far -- Don't record any usage info for this module
+ -- For (a) a library module, we don't record it at all unless it contains orphans
+ -- (We must never lose track of orphans.)
+ --
+ -- (b) a source-imported module, don't record the dependency at all
+ --
+ -- (b) may seem a bit strange. The idea is that the usages in a .hi file records
+ -- *all* the module's dependencies other than the loop-breakers. We use
+ -- this info in findAndReadInterface to decide whether to look for a .hi file or
+ -- a .hi-boot file.
+ --
+ -- This means we won't track version changes, or orphans, from .hi-boot files.
+ -- The former is potentially rather bad news. It could be fixed by recording
+ -- whether something is a boot file along with the usage info for it, but
+ -- I can't be bothered just now.
+
+ mk_version_info mod_name (version, has_orphans, Nothing) so_far
+ = ASSERT( not has_orphans ) -- If has_orphans is true we will have opened it
+ so_far -- We didn't even read this module's interface
+ -- so don't record dependency on it.
+
+ mk_version_info mod_name (version, has_orphans, Just (mod, boot_import, _)) so_far
+ | boot_import -- Don't record any usage info for this module
+ || (is_lib_module && not has_orphans)
+ = so_far