Skip to content

GHC API dependency analysis is broken

Sometimes, when a module fails to compile, GHC API invalidates other modules that do not depend on it (the attached example shows that) and sometimes the opposite --- it does not invalidate modules it should (I haven't created a standalone example with that so far). The problem is deterministic, but depends on the order in which targets are added using addSingle.

Generally, it seems if module B imports A, it correctly assumes A does not depend on B, but if B does not import A, it sometimes assumes A must depend on B, even if neither mentions the other. See comments in the example.

To reproduce, compile the example with

ghc --make typecheck-dir.hs -package ghc-7.4.2

create directory ./tmp and run typecheck-dir. You should see that module XXX is needlessly recompiled.

Trac metadata
Trac field Value
Version 7.4.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHC API
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information