Failure to recompile when #include file is created earlier on include path
Originally discovered when trying to improve Hadrian, for context see: https://github.com/snowleopard/hadrian/issues/247#issuecomment-222317602
If you create a file Main.hs
#include "Test.h"
main = print message
And a file a/Test.h
message = 1
Then run and compile with ghc --make -XCPP -Ib -Ia Main.hs it compiles and runs properly, printing 1. Changing a/Test.h to message = 2 then running ghc rebuilds and prints 2. Creating a fresh b/Test.h with message = 3 does not cause ghc to recompile, and thus incorrectly still prints 2. Touching Main.hs causes recompilation, and then the correct header file is picked up, resulting in 3 being printed.
Edited by Thomas Miedema