Skip to content

Finer-grained recompilation checking for exports

sheaf requested to merge sheaf/ghc:T25881 into master

Ticket: #25881 (closed)

This MR refines the recompilation checking logic, to avoid recompiling modules with an explicit import list when the modules they import start exporting new items. More specifically, when:

  1. module N imports module M,
  2. M is changed, but in a way that:
    a. preserves the exports that N imports
    b. does not introduce anything that forces recompilation downstream, such as orphan instances

then we no longer require recompilation of N.

Note that there is more to (2a) as initially meets the eye:

  • if N includes a whole module or import hiding import of M, then we require that the export list of M does not change,

  • if N only includes explicit imports, we check that the imported items don't change, e.g.

    • if we have import M(T(K, f), g), we must check that N continues to export all these identifiers, with the same Avail structure (i.e. we should error if N stops bundling K or f with T)
    • if we have import M(T(..)), we must check that the children of T have not changed

See Note [When to recompile when export lists change?] in GHC.Iface.Recomp.

This is all tested in the new tests RecompExports{1,2,3,4,5}

Edited by sheaf

Merge request reports

Loading