summaryrefslogtreecommitdiff
path: root/compiler/main
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@fb.com>2019-02-01 01:00:50 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-01 02:56:10 -0400
commit9ba0a4bd6eacaa8aeb5513658a10a17d52c32e8f (patch)
tree455d2fb6392981f871cfc7ff226ae728d2080a12 /compiler/main
parent6c27fd3517e17813baef2cb0130ec50798ff6543 (diff)
downloadhaskell-9ba0a4bd6eacaa8aeb5513658a10a17d52c32e8f.tar.gz
Fix #16219: TemplateHaskell causes indefinite package build errorcherry-pick-d6d735c1
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)
Diffstat (limited to 'compiler/main')
-rw-r--r--compiler/main/GhcMake.hs3
-rw-r--r--compiler/main/Packages.hs1
2 files changed, 4 insertions, 0 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index ae27d4e7fe..d5f58f8f9b 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -2045,6 +2045,9 @@ enableCodeGenForTH target nodemap =
, ms_hspp_opts = dflags@DynFlags
{hscTarget = HscNothing}
} <- ms
+ -- Don't enable codegen for TH on indefinite packages; we
+ -- can't compile anything anyway! See #16219.
+ , not (isIndefinite dflags)
, ms_mod `Set.member` needs_codegen_set
= do
let new_temp_file suf dynsuf = do
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index 70c9c26c11..44258de70c 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -58,6 +58,7 @@ module Packages (
pprPackages,
pprPackagesSimple,
pprModuleMap,
+ isIndefinite,
isDllName
)
where