diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-04-21 06:46:32 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-04-22 05:39:58 -0700 |
commit | a2f9fef1d90c073ad9c2a727c5ee617057ca6c1d (patch) | |
tree | 3d1c8418294a68b1cdaf27fa353d7843d6c8b1dd /compiler/iface/LoadIface.hs | |
parent | 1bd1ceffce7f3027ae632086844f95976ed600c8 (diff) | |
download | haskell-a2f9fef1d90c073ad9c2a727c5ee617057ca6c1d.tar.gz |
Fix #10182 by disallowing/avoiding self {-# SOURCE #-} imports
Summary:
hs-boot declarations were leaking into the EPS due to
self {-# SOURCE #-} imports, and interface loading induced by
orphan instances. For the former, we simply disallow self
{-# SOURCE #-} imports; for the latter, we simply just don't
load an interface if it would be ourself.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonpj, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D860
GHC Trac Issues: #10182
Diffstat (limited to 'compiler/iface/LoadIface.hs')
-rw-r--r-- | compiler/iface/LoadIface.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index 9571cecddd..defaa91c14 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -413,6 +413,7 @@ loadInterface :: SDoc -> Module -> WhereFrom loadInterface doc_str mod from = do { -- Read the state (eps,hpt) <- getEpsAndHpt + ; gbl_env <- getGblEnv ; traceIf (text "Considering whether to load" <+> ppr mod <+> ppr from) @@ -429,7 +430,15 @@ loadInterface doc_str mod from -- READ THE MODULE IN ; read_result <- case (wantHiBootFile dflags eps mod from) of Failed err -> return (Failed err) - Succeeded hi_boot_file -> findAndReadIface doc_str mod hi_boot_file + Succeeded hi_boot_file -> + -- Stoutly warn against an EPS-updating import + -- of one's own boot file! (one-shot only) + --See Note [Do not update EPS with your own hi-boot] + -- in MkIface. + WARN( hi_boot_file && + fmap fst (if_rec_types gbl_env) == Just mod, + ppr mod ) + findAndReadIface doc_str mod hi_boot_file ; case read_result of { Failed err -> do { let fake_iface = emptyModIface mod |