Unify hsig and hs-boot; add preliminary "hs-boot" merging.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Fri, 24 Jul 2015 22:13:49 +0000 (15:13 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Mon, 21 Sep 2015 18:53:56 +0000 (11:53 -0700)
commit06d46b1e4507e09eb2a7a04998a92610c8dc6277
tree7dc84733d3b6a8313c272c2c8fed4cc0b5d30e90
parent09d214dcd8e831c128c684facb7c8da1d63c58bc
Unify hsig and hs-boot; add preliminary "hs-boot" merging.

This patch drops the file level distinction between hs-boot and hsig;
we figure out which one we are compiling based on whether or not there
is a corresponding hs file lying around.

To make the "import A" syntax continue to work for bare hs-boot
files, we also introduce hs-boot merging, which takes an A.hi-boot
and converts it to an A.hi when there is no A.hs file in scope.
This will be generalized in Backpack to merge multiple A.hi files together;
which means we can jettison the "load multiple interface files" functionality.

This works automatically for --make, but for one-shot compilation
we need a new mode: ghc --merge-requirements A will generate an A.hi/A.o
from a local A.hi-boot file; Backpack will extend this mechanism further.

Has Haddock submodule update to deal with change in msHsFilePath behavior.

    - This commit drops support for the hsig extension. Can
      we support it?  It's annoying because the finder code is
      written with the assumption that where there's an hs-boot
      file, there's always an hs file too.  To support hsig, you'd
      have to probe two locations.  Easier to just not support it.

    - #10333 affects us, modifying an hs-boot still doesn't trigger
      recomp.

    - See compiler/main/Finder.hs: this diff is very skeevy, but
      it seems to work.

    - This code cunningly doesn't drop hs-boot files from the
      "drop hs-boot files" module graph, if they don't have a
      corresponding hs file.  I have no idea if this actually is useful.

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

Reviewers: simonpj, austin, bgamari, spinda

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1098
57 files changed:
compiler/deSugar/Desugar.hs
compiler/iface/LoadIface.hs
compiler/iface/MkIface.hs
compiler/main/DriverMkDepend.hs
compiler/main/DriverPhases.hs
compiler/main/DriverPipeline.hs
compiler/main/Finder.hs
compiler/main/GHC.hs
compiler/main/GhcMake.hs
compiler/main/HscMain.hs
compiler/main/HscTypes.hs
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcInstDcls.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnMonad.hs
ghc/Main.hs
testsuite/.gitignore
testsuite/tests/driver/dynamicToo/dynamicToo005/A005.hs-boot [moved from testsuite/tests/driver/dynamicToo/dynamicToo005/A005.hsig with 100% similarity]
testsuite/tests/driver/dynamicToo/dynamicToo005/Makefile
testsuite/tests/driver/dynamicToo/dynamicToo006/A.hs-boot [moved from testsuite/tests/driver/dynamicToo/dynamicToo006/A.hsig with 100% similarity]
testsuite/tests/driver/dynamicToo/dynamicToo006/Makefile
testsuite/tests/driver/recomp014/Makefile [new file with mode: 0644]
testsuite/tests/driver/recomp014/all.T [new file with mode: 0644]
testsuite/tests/driver/recomp014/recomp014.stdout [new file with mode: 0644]
testsuite/tests/driver/sigof01/B.hs-boot [moved from testsuite/tests/driver/sigof01/B.hsig with 100% similarity]
testsuite/tests/driver/sigof01/Makefile
testsuite/tests/driver/sigof01/all.T
testsuite/tests/driver/sigof01/sigof01i.script [new file with mode: 0644]
testsuite/tests/driver/sigof01/sigof01i.stdout [new file with mode: 0644]
testsuite/tests/driver/sigof01/sigof01i2.script [new file with mode: 0644]
testsuite/tests/driver/sigof01/sigof01i2.stdout [new file with mode: 0644]
testsuite/tests/driver/sigof01/sigof01m.stdout
testsuite/tests/driver/sigof02/Makefile
testsuite/tests/driver/sigof02/Map.hs-boot [moved from testsuite/tests/driver/sigof02/Map.hsig with 100% similarity]
testsuite/tests/driver/sigof02/MapAsSet.hs-boot [moved from testsuite/tests/driver/sigof02/MapAsSet.hsig with 100% similarity]
testsuite/tests/driver/sigof02/sigof02dm.stdout
testsuite/tests/driver/sigof02/sigof02m.stdout
testsuite/tests/driver/sigof03/ASig1.hs-boot [moved from testsuite/tests/driver/sigof03/ASig1.hsig with 100% similarity]
testsuite/tests/driver/sigof03/ASig2.hs-boot [moved from testsuite/tests/driver/sigof03/ASig2.hsig with 100% similarity]
testsuite/tests/driver/sigof03/Makefile
testsuite/tests/driver/sigof04/Makefile
testsuite/tests/driver/sigof04/Sig.hs-boot [moved from testsuite/tests/driver/sigof04/Sig.hsig with 100% similarity]
testsuite/tests/driver/sigof04/sigof04.stderr
testsuite/tests/typecheck/should_compile/all.T
testsuite/tests/typecheck/should_compile/tc264.hs-boot [moved from testsuite/tests/typecheck/should_compile/tc264.hsig with 100% similarity]
testsuite/tests/typecheck/should_compile/tc264.stderr
testsuite/tests/typecheck/should_fail/all.T
testsuite/tests/typecheck/should_fail/tcfail219.hs-boot [moved from testsuite/tests/typecheck/should_fail/tcfail219.hsig with 100% similarity]
testsuite/tests/typecheck/should_fail/tcfail219.stderr
testsuite/tests/typecheck/should_fail/tcfail220.hs-boot [moved from testsuite/tests/typecheck/should_fail/tcfail220.hsig with 100% similarity]
testsuite/tests/typecheck/should_fail/tcfail220.stderr
testsuite/tests/typecheck/should_fail/tcfail221.hs-boot [moved from testsuite/tests/typecheck/should_fail/tcfail221.hsig with 100% similarity]
testsuite/tests/typecheck/should_fail/tcfail221.stderr
testsuite/tests/typecheck/should_fail/tcfail222.hs-boot [moved from testsuite/tests/typecheck/should_fail/tcfail222.hsig with 100% similarity]
testsuite/tests/typecheck/should_fail/tcfail222.stderr
utils/ghctags/Main.hs
utils/haddock