Fix a Backpack recompilation avoidance bug when signatures change.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Sun, 12 Feb 2017 10:44:01 +0000 (02:44 -0800)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Fri, 17 Feb 2017 21:43:07 +0000 (13:43 -0800)
commitca543154bbf0ec36ee2654050ee67a467420449f
tree0962e9c12f0aab2631d20f80263d6a96ecbd5346
parent0e7601749d53d59df528ede996d8b54352051498
Fix a Backpack recompilation avoidance bug when signatures change.

Summary:
Recompilation avoidance checks if -this-unit-id has changed by relying
on the "wanted module" check in readIface ("Something is amiss...").
Unfortunately, this check didn't check if the instantiation made
sense, which meant that if you changed the signatures of a Backpack
package, we'd still treat the old signatures as up-to-date.

The way I fixed this was by having findAndReadIface take in a 'Module'
representing the /actual/ module we were intending to lookup.  We
convert this into the 'Module' we expect to see in 'mi_module' and
now do a more elaborate check that will also verify that instantiations
make sense.

Along the way, I robustified the logging infrastructure for
recompilation checking, and folded wrongIfaceModErr (which
was dead code) into the error message.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: bgamari, austin

Subscribers: thomie, snowleopard

Differential Revision: https://phabricator.haskell.org/D3130
17 files changed:
compiler/basicTypes/Module.hs
compiler/iface/FlagChecker.hs
compiler/iface/LoadIface.hs
compiler/iface/MkIface.hs
compiler/iface/TcIface.hs
compiler/typecheck/TcBackpack.hs
testsuite/driver/extra_files.py
testsuite/tests/backpack/cabal/bkpcabal04/.gitignore [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/Makefile [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/Setup.hs [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/all.T [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in1 [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/bkpcabal04.cabal.in2 [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/p/A.hsig [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/q/A/B.hsig.in [new file with mode: 0644]
testsuite/tests/backpack/cabal/bkpcabal04/q/B.hsig.in [new file with mode: 0644]
testsuite/tests/backpack/should_compile/bkp51.bkp