Fix #16219: TemplateHaskell causes indefinite package build error
authorEdward Z. Yang <ezyang@fb.com>
Fri, 1 Feb 2019 01:00:50 +0000 (20:00 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 1 Feb 2019 01:02:12 +0000 (20:02 -0500)
commitd6d735c1114082b9e9cc1ba7da87c49f52891320
tree45b2a9164d8487cafe939e7c75648b2c22e02c12
parentebe2d344899e2165182d3c41b0796ec022561790
Fix #16219: TemplateHaskell causes indefinite package build error

It should work to write an indefinite package using TemplateHaskell,
so long as all of the actual TH code lives outside of the package.
However, cleverness we had to build TH code even when building
with -fno-code meant that we attempted to build object code for
modules in an indefinite package, even when the signatures were
not instantiated.  This patch disables said logic in the event
that an indefinite package is being typechecked.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Test Plan: validate

Reviewers: simonpj, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #16219

Differential Revision: https://phabricator.haskell.org/D5475
compiler/main/GhcMake.hs
compiler/main/Packages.hs
testsuite/tests/backpack/cabal/T16219/LICENSE [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/Makefile [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/Setup.hs [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/all.T [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/backpack-issue.cabal [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/library-a-impl/A.hs [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/library-a/A/Sig.hsig [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/library-a/B.hs [new file with mode: 0644]
testsuite/tests/backpack/cabal/T16219/library-b/C.hs [new file with mode: 0644]