Finer-grained recompilation checking for exports
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:
- module
Nimports moduleM, -
Mis 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
Nincludes a whole module orimport hidingimport ofM, then we require that the export list ofMdoes not change, -
if
Nonly 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 thatNcontinues to export all these identifiers, with the sameAvailstructure (i.e. we should error ifNstops bundlingKorfwithT) - if we have
import M(T(..)), we must check that the children ofThave not changed
- if we have
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