diff options
author | Edward Z. Yang <ezyang@fb.com> | 2019-01-31 20:00:50 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-01-31 20:02:12 -0500 |
commit | d6d735c1114082b9e9cc1ba7da87c49f52891320 (patch) | |
tree | 45b2a9164d8487cafe939e7c75648b2c22e02c12 /compiler | |
parent | ebe2d344899e2165182d3c41b0796ec022561790 (diff) | |
download | haskell-d6d735c1114082b9e9cc1ba7da87c49f52891320.tar.gz |
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
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/main/GhcMake.hs | 3 | ||||
-rw-r--r-- | compiler/main/Packages.hs | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 85925b3ef9..a6fe5c7f72 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 |