Fix #16219: TemplateHaskell causes indefinite package build error cherry-pick-d6d735c1
authorEdward Z. Yang <ezyang@fb.com>
Fri, 1 Feb 2019 01:00:50 +0000 (01:00 +0000)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Mon, 1 Apr 2019 06:56:10 +0000 (02:56 -0400)
commit9ba0a4bd6eacaa8aeb5513658a10a17d52c32e8f
tree455d2fb6392981f871cfc7ff226ae728d2080a12
parent6c27fd3517e17813baef2cb0130ec50798ff6543
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

(cherry picked from commit d6d735c1114082b9e9cc1ba7da87c49f52891320)
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]