[commit: ghc] master: Doc: checkCrossStageLifting, RnSplice/TcExpr is untyped/typed brackets (#10384) (341a766)

git at git.haskell.org git at git.haskell.org
Tue May 5 17:35:25 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/341a76641426a452fc27d3b9383945b9744c600a/ghc

>---------------------------------------------------------------

commit 341a76641426a452fc27d3b9383945b9744c600a
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Tue May 5 10:34:33 2015 -0700

    Doc: checkCrossStageLifting, RnSplice/TcExpr is untyped/typed brackets (#10384)
    
    Clarify that repeated checkCrossStageLifting in RnSplice/TcExpr
    check untyped/typed brackets, respectively.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>


>---------------------------------------------------------------

341a76641426a452fc27d3b9383945b9744c600a
 compiler/rename/RnSplice.hs  |  3 +++
 compiler/typecheck/TcExpr.hs | 11 +++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/compiler/rename/RnSplice.hs b/compiler/rename/RnSplice.hs
index 930cea3..a20640b 100644
--- a/compiler/rename/RnSplice.hs
+++ b/compiler/rename/RnSplice.hs
@@ -595,6 +595,9 @@ checkCrossStageLifting :: TopLevelFlag -> Name -> ThStage -> TcM ()
 -- Now we must check whether there's a cross-stage lift to do
 -- Examples   \x -> [| x |]
 --            [| map |]
+--
+-- This code is similar to checkCrossStageLifting in TcExpr, but
+-- this is only run on *untyped* brackets.
 
 checkCrossStageLifting top_lvl name (Brack _ (RnPendingUntyped ps_var))
   | isTopLevel top_lvl
diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs
index 67b60c5..3fc5cf2 100644
--- a/compiler/typecheck/TcExpr.hs
+++ b/compiler/typecheck/TcExpr.hs
@@ -1254,15 +1254,18 @@ checkThLocalId id
 
 --------------------------------------
 checkCrossStageLifting :: Id -> ThStage -> TcM ()
--- If we are inside brackets, and (use_lvl > bind_lvl)
+-- If we are inside typed brackets, and (use_lvl > bind_lvl)
 -- we must check whether there's a cross-stage lift to do
--- Examples   \x -> [| x |]
---            [| map |]
+-- Examples   \x -> [|| x ||]
+--            [|| map ||]
 -- There is no error-checking to do, because the renamer did that
+--
+-- This is similar to checkCrossStageLifting in RnSplice, but
+-- this code is applied to *typed* brackets.
 
 checkCrossStageLifting id (Brack _ (TcPending ps_var lie_var))
   =     -- Nested identifiers, such as 'x' in
-        -- E.g. \x -> [| h x |]
+        -- E.g. \x -> [|| h x ||]
         -- We must behave as if the reference to x was
         --      h $(lift x)
         -- We use 'x' itself as the splice proxy, used by



More information about the ghc-commits mailing list