diff options
| author | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2018-10-04 13:50:54 -0400 |
|---|---|---|
| committer | Ben Gamari <ben@smart-cactus.org> | 2018-10-04 22:27:54 -0400 |
| commit | e5013a567b230018b5d39b562ce21faf54740d04 (patch) | |
| tree | 20922c956eb0171dcafe4d4ea83dd5c5392b76c8 /compiler/rename | |
| parent | 98daa34c73ed2a4bccc4cfb6608c6a614da61f8c (diff) | |
| download | haskell-e5013a567b230018b5d39b562ce21faf54740d04.tar.gz | |
Make TcRnMonad independent of TcSplice (#14391)
Test Plan: validate
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, carter
GHC Trac Issues: #14391
Differential Revision: https://phabricator.haskell.org/D5135
Diffstat (limited to 'compiler/rename')
| -rw-r--r-- | compiler/rename/RnSplice.hs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/rename/RnSplice.hs b/compiler/rename/RnSplice.hs index 19bf763f63..c26d03a645 100644 --- a/compiler/rename/RnSplice.hs +++ b/compiler/rename/RnSplice.hs @@ -51,7 +51,6 @@ import {-# SOURCE #-} TcSplice , runMetaE , runMetaP , runMetaT - , runRemoteModFinalizers , tcTopSpliceExpr ) @@ -638,9 +637,16 @@ rnTopSpliceDecls splice rnSplice splice -- As always, be sure to checkNoErrs above lest we end up with -- holes making it to typechecking, hence #12584. + -- + -- Note that we cannot call checkNoErrs for the whole duration + -- of rnTopSpliceDecls. The reason is that checkNoErrs changes + -- the local environment to temporarily contain a new + -- reference to store errors, and add_mod_finalizers would + -- cause this reference to be stored after checkNoErrs finishes. + -- This is checked by test TH_finalizer. ; traceRn "rnTopSpliceDecls: untyped declaration splice" empty - ; (decls, mod_finalizers) <- - runRnSplice UntypedDeclSplice runMetaD ppr_decls rn_splice + ; (decls, mod_finalizers) <- checkNoErrs $ + runRnSplice UntypedDeclSplice runMetaD ppr_decls rn_splice ; add_mod_finalizers_now mod_finalizers ; return (decls,fvs) } where @@ -658,8 +664,9 @@ rnTopSpliceDecls splice add_mod_finalizers_now [] = return () add_mod_finalizers_now mod_finalizers = do th_modfinalizers_var <- fmap tcg_th_modfinalizers getGblEnv + env <- getLclEnv updTcRef th_modfinalizers_var $ \fins -> - runRemoteModFinalizers (ThModFinalizers mod_finalizers) : fins + (env, ThModFinalizers mod_finalizers) : fins {- |
