Opened 4 years ago

Last modified 3 years ago

#9841 new bug

Touching a file that uses TH triggers TH recompilation flood

Reported by: nh2 Owned by:
Priority: normal Milestone:
Component: Driver Version: 7.8.3
Keywords: Cc: nh2
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: #481, #7277 Differential Rev(s):
Wiki Page:

Description

Check out this test case:

https://github.com/nh2/ghc-th-recomp-touch-test

I have 2 modules, A and B, both using TH (using aeson) with B importing A.

After the first compilation, touch A.hs && ghc --make B.hs causes B to be recompiled.

Why should this be the case? If we see that the A.hi file is completely identical with what it was before, why should we recompile B?

This problem actually hits pretty hard when working in projects with > 200 modules.

(This all is under the assumption that TH doesn't do any IO with observably different result; we do already have this assumption if I understand it correctly, since otherwise we would always recompile all TH code, which we don't.)


Another problem is that the process is not very repeatable:

If you do touch A.hs && ghc --make All.hs and hit Ctrl-C before everything is done (e.g. after the 3rd modules), and then run just ghc --make All.hs, then GHC will decide to compile nothing at all, even though it had determined just before that everything needs to be recompiled. Is this expected?

Change History (4)

comment:1 Changed 4 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:2 Changed 4 years ago by thomie

Component: Build SystemDriver

comment:3 Changed 3 years ago by thoughtpolice

Milestone: 7.12.18.0.1

Milestone renamed

comment:4 Changed 3 years ago by thomie

Milestone: 8.0.1
Note: See TracTickets for help on using tickets.