`ghc --make` recompiles unchanged files when using `-fplugin` OPTIONS
Consider this bare-bones module
{-# OPTIONS -fplugin GHC.TypeLits.Normalise #-}
module A where
compiling it will always say
$ ghc --make A.hs
[1 of 1] Compiling A ( A.hs, A.o ) [GHC.TypeLits.Normalise changed]
even when the module was compiled before.
$ ghc A.hs -c -ddump-if-trace -ddump-hi-diffs
will give the reason:
imported module ‘GHC.TypeLits.Normalise’ is from package ‘ghc-typelits-natnormalise-0.5’, which is not among previous dependencies
Which is the probable cause: when writing the .hi file, the used plugins' package dependencies should be also written out. AFAICS they are extracted fron the DynFlags but for this comparison in
checkDependencies :: HscEnv -> ModSummary -> ModIface -> IfG RecompileRequired
but not found in the ModSummary that was originally written to disk.
This is pretty nasty for clash compilations and the suspected bug is documented here: https://github.com/clash-lang/ghc-typelits-natnormalise/issues/2
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |