summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-05-05 10:34:33 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-05-05 10:35:51 -0700
commit341a76641426a452fc27d3b9383945b9744c600a (patch)
treeb1464a9efa8b98daf9d4925af6007d330ca6f38e
parent1a4374c1e246d81a5c1d00a720919804093a8241 (diff)
downloadhaskell-341a76641426a452fc27d3b9383945b9744c600a.tar.gz
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@cs.stanford.edu>
-rw-r--r--compiler/rename/RnSplice.hs3
-rw-r--r--compiler/typecheck/TcExpr.hs11
2 files changed, 10 insertions, 4 deletions
diff --git a/compiler/rename/RnSplice.hs b/compiler/rename/RnSplice.hs
index 930cea3ff3..a20640b07c 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 67b60c573f..3fc5cf22f4 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