Have addModFinalizer expose the local type environment.
authorFacundo Domínguez <facundo.dominguez@tweag.io>
Wed, 6 Jul 2016 09:48:27 +0000 (06:48 -0300)
committerFacundo Domínguez <facundo.dominguez@tweag.io>
Wed, 6 Jul 2016 09:48:27 +0000 (06:48 -0300)
commit567dbd9bcb602accf3184b83050f2982cbb7758b
treec7b9930fe4d21db8b38e17edbde9a05dd472de26
parentf560a03ccdb246083fe64da3507c5be4c40960fe
Have addModFinalizer expose the local type environment.

Summary:
This annotates the splice point with 'HsSpliced ref e' where 'e' is the
result of the splice. 'ref' is a reference that the typechecker will fill with
the local type environment.

The finalizer then reads the ref and uses the local type environment, which
causes 'reify' to find local variables when run in the finalizer.

Test Plan: ./validate

Reviewers: simonpj, simonmar, bgamari, austin, goldfire

Reviewed By: goldfire

Subscribers: simonmar, thomie, mboes

Differential Revision: https://phabricator.haskell.org/D2286

GHC Trac Issues: #11832
19 files changed:
compiler/deSugar/DsMeta.hs
compiler/hsSyn/HsExpr.hs
compiler/rename/RnPat.hs
compiler/rename/RnSplice.hs
compiler/rename/RnTypes.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcPat.hs
compiler/typecheck/TcRnMonad.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSplice.hs
compiler/typecheck/TcSplice.hs-boot
iserv/src/Main.hs
libraries/ghci/GHCi/Message.hs
libraries/ghci/GHCi/TH.hs
libraries/template-haskell/Language/Haskell/TH/Syntax.hs
testsuite/tests/th/TH_reifyLocalDefs.hs [new file with mode: 0644]
testsuite/tests/th/TH_reifyLocalDefs.stderr [new file with mode: 0644]
testsuite/tests/th/all.T