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
N
imports moduleM
, -
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 orimport hiding
import ofM
, then we require that the export list ofM
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 thatN
continues to export all these identifiers, with the sameAvail
structure (i.e. we should error ifN
stops bundlingK
orf
withT
) - if we have
import M(T(..))
, we must check that the children ofT
have 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