summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2021-06-10 16:04:26 +0300
committerVladislav Zavialov <vlad.z.4096@gmail.com>2021-06-10 16:04:26 +0300
commitf1982a5cfb7b0b3d534167e40db0f390cc0adaa3 (patch)
treebdea70b71df66157aefbe0c1fb0180f26b709955
parent8ca20db863ffa80a3e2aed492603010e1f7c3e23 (diff)
downloadhaskell-wip/hs-token-let.tar.gz
WIP: HsToken for let/inwip/hs-token-let
-rw-r--r--compiler/GHC/Hs/Dump.hs4
-rw-r--r--compiler/GHC/Hs/Expr.hs18
-rw-r--r--compiler/GHC/Hs/Syn/Type.hs2
-rw-r--r--compiler/GHC/HsToCore/Arrows.hs2
-rw-r--r--compiler/GHC/HsToCore/Coverage.hs20
-rw-r--r--compiler/GHC/HsToCore/Expr.hs2
-rw-r--r--compiler/GHC/HsToCore/Quote.hs2
-rw-r--r--compiler/GHC/Iface/Ext/Ast.hs6
-rw-r--r--compiler/GHC/Parser.y3
-rw-r--r--compiler/GHC/Parser/PostProcess.hs17
-rw-r--r--compiler/GHC/Rename/Expr.hs10
-rw-r--r--compiler/GHC/Tc/Gen/Arrow.hs4
-rw-r--r--compiler/GHC/Tc/Gen/Expr.hs4
-rw-r--r--compiler/GHC/Tc/Types/Origin.hs2
-rw-r--r--compiler/GHC/Tc/Utils/Zonk.hs8
-rw-r--r--compiler/GHC/ThToHs.hs2
-rw-r--r--compiler/Language/Haskell/Syntax/Expr.hs4
17 files changed, 54 insertions, 56 deletions
diff --git a/compiler/GHC/Hs/Dump.hs b/compiler/GHC/Hs/Dump.hs
index 9be0f96640..4b02179967 100644
--- a/compiler/GHC/Hs/Dump.hs
+++ b/compiler/GHC/Hs/Dump.hs
@@ -57,7 +57,6 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0
`extQ` annotationAddEpAnn
`extQ` annotationGrhsAnn
`extQ` annotationEpAnnHsCase
- `extQ` annotationEpAnnHsLet
`extQ` annotationAnnList
`extQ` annotationEpAnnImportDecl
`extQ` annotationAnnParen
@@ -239,9 +238,6 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0
annotationEpAnnHsCase :: EpAnn EpAnnHsCase -> SDoc
annotationEpAnnHsCase = annotation' (text "EpAnn EpAnnHsCase")
- annotationEpAnnHsLet :: EpAnn AnnsLet -> SDoc
- annotationEpAnnHsLet = annotation' (text "EpAnn AnnsLet")
-
annotationAnnList :: EpAnn AnnList -> SDoc
annotationAnnList = annotation' (text "EpAnn AnnList")
diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs
index 72ac021e45..9248818f9c 100644
--- a/compiler/GHC/Hs/Expr.hs
+++ b/compiler/GHC/Hs/Expr.hs
@@ -315,7 +315,7 @@ type instance XMultiIf GhcPs = EpAnn [AddEpAnn]
type instance XMultiIf GhcRn = NoExtField
type instance XMultiIf GhcTc = Type
-type instance XLet GhcPs = EpAnn AnnsLet
+type instance XLet GhcPs = EpAnnCO
type instance XLet GhcRn = NoExtField
type instance XLet GhcTc = NoExtField
@@ -397,12 +397,6 @@ data AnnExplicitSum
aesClose :: EpaLocation
} deriving Data
-data AnnsLet
- = AnnsLet {
- alLet :: EpaLocation,
- alIn :: EpaLocation
- } deriving Data
-
data AnnFieldLabel
= AnnFieldLabel {
afDot :: Maybe EpaLocation
@@ -624,11 +618,11 @@ ppr_expr (HsMultiIf _ alts)
ppr_alt (L _ (XGRHS x)) = ppr x
-- special case: let ... in let ...
-ppr_expr (HsLet _ binds expr@(L _ (HsLet _ _ _)))
+ppr_expr (HsLet _ _ binds _ expr@(L _ (HsLet _ _ _ _ _)))
= sep [hang (text "let") 2 (hsep [pprBinds binds, text "in"]),
ppr_lexpr expr]
-ppr_expr (HsLet _ binds expr)
+ppr_expr (HsLet _ _ binds _ expr)
= sep [hang (text "let") 2 (pprBinds binds),
hang (text "in") 2 (ppr expr)]
@@ -1082,7 +1076,7 @@ type instance XCmdIf GhcPs = EpAnn AnnsIf
type instance XCmdIf GhcRn = NoExtField
type instance XCmdIf GhcTc = NoExtField
-type instance XCmdLet GhcPs = EpAnn AnnsLet
+type instance XCmdLet GhcPs = EpAnnCO
type instance XCmdLet GhcRn = NoExtField
type instance XCmdLet GhcTc = NoExtField
@@ -1168,11 +1162,11 @@ ppr_cmd (HsCmdIf _ _ e ct ce)
nest 4 (ppr ce)]
-- special case: let ... in let ...
-ppr_cmd (HsCmdLet _ binds cmd@(L _ (HsCmdLet {})))
+ppr_cmd (HsCmdLet _ _ binds _ cmd@(L _ (HsCmdLet {})))
= sep [hang (text "let") 2 (hsep [pprBinds binds, text "in"]),
ppr_lcmd cmd]
-ppr_cmd (HsCmdLet _ binds cmd)
+ppr_cmd (HsCmdLet _ _ binds _ cmd)
= sep [hang (text "let") 2 (pprBinds binds),
hang (text "in") 2 (ppr cmd)]
diff --git a/compiler/GHC/Hs/Syn/Type.hs b/compiler/GHC/Hs/Syn/Type.hs
index 6428a99ff4..1080ad6cc2 100644
--- a/compiler/GHC/Hs/Syn/Type.hs
+++ b/compiler/GHC/Hs/Syn/Type.hs
@@ -110,7 +110,7 @@ hsExprType (ExplicitSum alt_tys _ _ _) = mkSumTy alt_tys
hsExprType (HsCase _ _ (MG { mg_ext = match_group })) = mg_res_ty match_group
hsExprType (HsIf _ _ t _) = lhsExprType t
hsExprType (HsMultiIf ty _) = ty
-hsExprType (HsLet _ _ body) = lhsExprType body
+hsExprType (HsLet _ _ _ _ body) = lhsExprType body
hsExprType (HsDo ty _ _) = ty
hsExprType (ExplicitList ty _) = mkListTy ty
hsExprType (RecordCon con_expr _ _) = hsExprType con_expr
diff --git a/compiler/GHC/HsToCore/Arrows.hs b/compiler/GHC/HsToCore/Arrows.hs
index 4a31b9fc8d..3054eceecf 100644
--- a/compiler/GHC/HsToCore/Arrows.hs
+++ b/compiler/GHC/HsToCore/Arrows.hs
@@ -602,7 +602,7 @@ dsCmd ids local_vars stack_ty res_ty
--
-- ---> premap (\ ((xs),stk) -> let binds in ((ys),stk)) c
-dsCmd ids local_vars stack_ty res_ty (HsCmdLet _ lbinds@binds body) env_ids = do
+dsCmd ids local_vars stack_ty res_ty (HsCmdLet _ _ lbinds@binds _ body) env_ids = do
let
defined_vars = mkVarSet (collectLocalBinders CollWithDictBinders binds)
local_vars' = defined_vars `unionVarSet` local_vars
diff --git a/compiler/GHC/HsToCore/Coverage.hs b/compiler/GHC/HsToCore/Coverage.hs
index a6b9944292..326abee504 100644
--- a/compiler/GHC/HsToCore/Coverage.hs
+++ b/compiler/GHC/HsToCore/Coverage.hs
@@ -575,11 +575,11 @@ addTickHsExpr (HsMultiIf ty alts)
= do { let isOneOfMany = case alts of [_] -> False; _ -> True
; alts' <- mapM (liftL $ addTickGRHS isOneOfMany False) alts
; return $ HsMultiIf ty alts' }
-addTickHsExpr (HsLet x binds e) =
- bindLocals (collectLocalBinders CollNoDictBinders binds) $
- liftM2 (HsLet x)
- (addTickHsLocalBinds binds) -- to think about: !patterns.
- (addTickLHsExprLetBody e)
+addTickHsExpr (HsLet x tkLet binds tkIn e) =
+ bindLocals (collectLocalBinders CollNoDictBinders binds) $ do
+ binds' <- addTickHsLocalBinds binds -- to think about: !patterns.
+ e' <- addTickLHsExprLetBody e
+ return (HsLet x tkLet binds' tkIn e')
addTickHsExpr (HsDo srcloc cxt (L l stmts))
= do { (stmts', _) <- addTickLStmts' forQual stmts (return ())
; return (HsDo srcloc cxt (L l stmts')) }
@@ -884,11 +884,11 @@ addTickHsCmd (HsCmdIf x cnd e1 c2 c3) =
(addBinTickLHsExpr (BinBox CondBinBox) e1)
(addTickLHsCmd c2)
(addTickLHsCmd c3)
-addTickHsCmd (HsCmdLet x binds c) =
- bindLocals (collectLocalBinders CollNoDictBinders binds) $
- liftM2 (HsCmdLet x)
- (addTickHsLocalBinds binds) -- to think about: !patterns.
- (addTickLHsCmd c)
+addTickHsCmd (HsCmdLet x tkLet binds tkIn c) =
+ bindLocals (collectLocalBinders CollNoDictBinders binds) $ do
+ binds' <- addTickHsLocalBinds binds -- to think about: !patterns.
+ c' <- addTickLHsCmd c
+ return (HsCmdLet x tkLet binds' tkIn c')
addTickHsCmd (HsCmdDo srcloc (L l stmts))
= do { (stmts', _) <- addTickLCmdStmts' stmts (return ())
; return (HsCmdDo srcloc (L l stmts')) }
diff --git a/compiler/GHC/HsToCore/Expr.hs b/compiler/GHC/HsToCore/Expr.hs
index 602950bf3e..fa322a774b 100644
--- a/compiler/GHC/HsToCore/Expr.hs
+++ b/compiler/GHC/HsToCore/Expr.hs
@@ -357,7 +357,7 @@ dsExpr (HsCase _ discrim matches)
-- Pepe: The binds are in scope in the body but NOT in the binding group
-- This is to avoid silliness in breakpoints
-dsExpr (HsLet _ binds body) = do
+dsExpr (HsLet _ _ binds _ body) = do
body' <- dsLExpr body
dsLocalBinds binds body'
diff --git a/compiler/GHC/HsToCore/Quote.hs b/compiler/GHC/HsToCore/Quote.hs
index 0860192e68..20a8a8622c 100644
--- a/compiler/GHC/HsToCore/Quote.hs
+++ b/compiler/GHC/HsToCore/Quote.hs
@@ -1526,7 +1526,7 @@ repE (HsMultiIf _ alts)
= do { (binds, alts') <- liftM unzip $ mapM repLGRHS alts
; expr' <- repMultiIf (nonEmptyCoreList alts')
; wrapGenSyms (concat binds) expr' }
-repE (HsLet _ bs e) = do { (ss,ds) <- repBinds bs
+repE (HsLet _ _ bs _ e) = do { (ss,ds) <- repBinds bs
; e2 <- addBinds ss (repLE e)
; z <- repLetE ds e2
; wrapGenSyms ss z }
diff --git a/compiler/GHC/Iface/Ext/Ast.hs b/compiler/GHC/Iface/Ext/Ast.hs
index f198dc55c1..fe48d6b644 100644
--- a/compiler/GHC/Iface/Ext/Ast.hs
+++ b/compiler/GHC/Iface/Ext/Ast.hs
@@ -735,7 +735,7 @@ instance HiePass p => HasType (LocatedA (HsExpr (GhcPass p))) where
HsPar _ _ e _ -> computeLType e
ExplicitTuple{} -> Nothing
HsIf _ _ t f -> computeLType t <|> computeLType f
- HsLet _ _ body -> computeLType body
+ HsLet _ _ _ _ body -> computeLType body
RecordCon con_expr _ _ -> computeType con_expr
ExprWithTySig _ e _ -> computeLType e
HsStatic _ e -> computeLType e
@@ -1140,7 +1140,7 @@ instance HiePass p => ToHie (LocatedA (HsExpr (GhcPass p))) where
HsMultiIf _ grhss ->
[ toHie grhss
]
- HsLet _ binds expr ->
+ HsLet _ _ binds _ expr ->
[ toHie $ RS (mkLScopeA expr) binds
, toHie expr
]
@@ -1429,7 +1429,7 @@ instance HiePass p => ToHie (LocatedA (HsCmd (GhcPass p))) where
, toHie b
, toHie c
]
- HsCmdLet _ binds cmd' ->
+ HsCmdLet _ _ binds _ cmd' ->
[ toHie $ RS (mkLScopeA cmd') binds
, toHie cmd'
]
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y
index 15088081e1..ca8265fc48 100644
--- a/compiler/GHC/Parser.y
+++ b/compiler/GHC/Parser.y
@@ -2795,8 +2795,7 @@ aexp :: { ECP }
, m_grhss = unguardedGRHSs (comb2 $3 (reLoc $4)) $4 (EpAnn (glR $3) (GrhsAnn Nothing (mu AnnRarrow $3)) emptyComments) }])) }
| 'let' binds 'in' exp { ECP $
unECP $4 >>= \ $4 ->
- mkHsLetPV (comb2A $1 $>) (unLoc $2) $4
- (AnnsLet (glAA $1) (glAA $3)) }
+ mkHsLetPV (comb2A $1 $>) (hsTok $1) (unLoc $2) (hsTok $3) $4 }
| '\\' 'lcase' altslist
{ ECP $ $3 >>= \ $3 ->
mkHsLamCasePV (comb2 $1 (reLoc $>)) $3 [mj AnnLam $1,mj AnnCase $2] }
diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs
index 946b9a87f3..788cbec56a 100644
--- a/compiler/GHC/Parser/PostProcess.hs
+++ b/compiler/GHC/Parser/PostProcess.hs
@@ -1444,7 +1444,12 @@ class (b ~ (Body b) GhcPs, AnnoBody b) => DisambECP b where
:: SrcSpan -> (EpAnnComments -> MatchGroup GhcPs (LocatedA b)) -> PV (LocatedA b)
-- | Disambiguate "let ... in ..."
mkHsLetPV
- :: SrcSpan -> HsLocalBinds GhcPs -> LocatedA b -> AnnsLet -> PV (LocatedA b)
+ :: SrcSpan
+ -> LHsToken "let" GhcPs
+ -> HsLocalBinds GhcPs
+ -> LHsToken "in" GhcPs
+ -> LocatedA b
+ -> PV (LocatedA b)
-- | Infix operator representation
type InfixOp b
-- | Bring superclass constraints on InfixOp into scope.
@@ -1585,9 +1590,9 @@ instance DisambECP (HsCmd GhcPs) where
mkHsLamPV l mg = do
cs <- getCommentsFor l
return $ L (noAnnSrcSpan l) (HsCmdLam NoExtField (mg cs))
- mkHsLetPV l bs e anns = do
+ mkHsLetPV l tkLet bs tkIn e = do
cs <- getCommentsFor l
- return $ L (noAnnSrcSpan l) (HsCmdLet (EpAnn (spanAsAnchor l) anns cs) bs e)
+ return $ L (noAnnSrcSpan l) (HsCmdLet (EpAnn (spanAsAnchor l) NoEpAnns cs) tkLet bs tkIn e)
type InfixOp (HsCmd GhcPs) = HsExpr GhcPs
superInfixOp m = m
mkHsOpAppPV l c1 op c2 = do
@@ -1672,9 +1677,9 @@ instance DisambECP (HsExpr GhcPs) where
let mg' = mg cs
checkLamMatchGroup l mg'
return $ L (noAnnSrcSpan l) (HsLam NoExtField mg')
- mkHsLetPV l bs c anns = do
+ mkHsLetPV l tkLet bs tkIn c = do
cs <- getCommentsFor l
- return $ L (noAnnSrcSpan l) (HsLet (EpAnn (spanAsAnchor l) anns cs) bs c)
+ return $ L (noAnnSrcSpan l) (HsLet (EpAnn (spanAsAnchor l) NoEpAnns cs) tkLet bs tkIn c)
type InfixOp (HsExpr GhcPs) = HsExpr GhcPs
superInfixOp m = m
mkHsOpAppPV l e1 op e2 = do
@@ -1764,7 +1769,7 @@ instance DisambECP (PatBuilder GhcPs) where
ecpFromCmd' (L l c) = addFatalError $ mkPlainErrorMsgEnvelope (locA l) $ PsErrArrowCmdInPat c
ecpFromExp' (L l e) = addFatalError $ mkPlainErrorMsgEnvelope (locA l) $ PsErrArrowExprInPat e
mkHsLamPV l _ = addFatalError $ mkPlainErrorMsgEnvelope l PsErrLambdaInPat
- mkHsLetPV l _ _ _ = addFatalError $ mkPlainErrorMsgEnvelope l PsErrLetInPat
+ mkHsLetPV l _ _ _ _ = addFatalError $ mkPlainErrorMsgEnvelope l PsErrLetInPat
mkHsProjUpdatePV l _ _ _ _ = addFatalError $ mkPlainErrorMsgEnvelope l PsErrOverloadedRecordDotInvalid
type InfixOp (PatBuilder GhcPs) = RdrName
superInfixOp m = m
diff --git a/compiler/GHC/Rename/Expr.hs b/compiler/GHC/Rename/Expr.hs
index aff3ce3dbd..bf0513e0ad 100644
--- a/compiler/GHC/Rename/Expr.hs
+++ b/compiler/GHC/Rename/Expr.hs
@@ -371,10 +371,10 @@ rnExpr (HsCase _ expr matches)
; (new_matches, ms_fvs) <- rnMatchGroup CaseAlt rnLExpr matches
; return (HsCase noExtField new_expr new_matches, e_fvs `plusFV` ms_fvs) }
-rnExpr (HsLet _ binds expr)
+rnExpr (HsLet _ tkLet binds tkIn expr)
= rnLocalBindsAndThen binds $ \binds' _ -> do
{ (expr',fvExpr) <- rnLExpr expr
- ; return (HsLet noExtField binds' expr', fvExpr) }
+ ; return (HsLet noExtField tkLet binds' tkIn expr', fvExpr) }
rnExpr (HsDo _ do_or_lc (L l stmts))
= do { ((stmts', _), fvs) <-
@@ -809,10 +809,10 @@ rnCmd (HsCmdIf _ _ p b1 b2)
; return (HsCmdIf noExtField ite p' b1' b2', plusFVs [fvITE, fvP, fvB1, fvB2])}
-rnCmd (HsCmdLet _ binds cmd)
+rnCmd (HsCmdLet _ tkLet binds tkIn cmd)
= rnLocalBindsAndThen binds $ \ binds' _ -> do
{ (cmd',fvExpr) <- rnLCmd cmd
- ; return (HsCmdLet noExtField binds' cmd', fvExpr) }
+ ; return (HsCmdLet noExtField tkLet binds' tkIn cmd', fvExpr) }
rnCmd (HsCmdDo _ (L l stmts))
= do { ((stmts', _), fvs) <-
@@ -840,7 +840,7 @@ methodNamesCmd (HsCmdPar _ _ c _) = methodNamesLCmd c
methodNamesCmd (HsCmdIf _ _ _ c1 c2)
= methodNamesLCmd c1 `plusFV` methodNamesLCmd c2 `addOneFV` choiceAName
-methodNamesCmd (HsCmdLet _ _ c) = methodNamesLCmd c
+methodNamesCmd (HsCmdLet _ _ _ _ c) = methodNamesLCmd c
methodNamesCmd (HsCmdDo _ (L _ stmts)) = methodNamesStmts stmts
methodNamesCmd (HsCmdApp _ c _) = methodNamesLCmd c
methodNamesCmd (HsCmdLam _ match) = methodNamesMatch match
diff --git a/compiler/GHC/Tc/Gen/Arrow.hs b/compiler/GHC/Tc/Gen/Arrow.hs
index 2d957fd217..bc5edd6917 100644
--- a/compiler/GHC/Tc/Gen/Arrow.hs
+++ b/compiler/GHC/Tc/Gen/Arrow.hs
@@ -149,11 +149,11 @@ tc_cmd env (HsCmdPar x lpar cmd rpar) res_ty
= do { cmd' <- tcCmd env cmd res_ty
; return (HsCmdPar x lpar cmd' rpar) }
-tc_cmd env (HsCmdLet x binds (L body_loc body)) res_ty
+tc_cmd env (HsCmdLet x tkLet binds tkIn (L body_loc body)) res_ty
= do { (binds', body') <- tcLocalBinds binds $
setSrcSpan (locA body_loc) $
tc_cmd env body res_ty
- ; return (HsCmdLet x binds' (L body_loc body')) }
+ ; return (HsCmdLet x tkLet binds' tkIn (L body_loc body')) }
tc_cmd env in_cmd@(HsCmdCase x scrut matches) (stk, res_ty)
= addErrCtxt (cmdCtxt in_cmd) $ do
diff --git a/compiler/GHC/Tc/Gen/Expr.hs b/compiler/GHC/Tc/Gen/Expr.hs
index 40c7052de5..29bf228496 100644
--- a/compiler/GHC/Tc/Gen/Expr.hs
+++ b/compiler/GHC/Tc/Gen/Expr.hs
@@ -354,10 +354,10 @@ tcExpr (ExplicitSum _ alt arity expr) res_ty
************************************************************************
-}
-tcExpr (HsLet x binds expr) res_ty
+tcExpr (HsLet x tkLet binds tkIn expr) res_ty
= do { (binds', expr') <- tcLocalBinds binds $
tcMonoExpr expr res_ty
- ; return (HsLet x binds' expr') }
+ ; return (HsLet x tkLet binds' tkIn expr') }
tcExpr (HsCase x scrut matches) res_ty
= do { -- We used to typecheck the case alternatives first.
diff --git a/compiler/GHC/Tc/Types/Origin.hs b/compiler/GHC/Tc/Types/Origin.hs
index e35f5ba385..7a4b41c991 100644
--- a/compiler/GHC/Tc/Types/Origin.hs
+++ b/compiler/GHC/Tc/Types/Origin.hs
@@ -523,7 +523,7 @@ exprCtOrigin ExplicitSum{} = Shouldn'tHappenOrigin "explicit sum"
exprCtOrigin (HsCase _ _ matches) = matchesCtOrigin matches
exprCtOrigin (HsIf {}) = Shouldn'tHappenOrigin "if expression"
exprCtOrigin (HsMultiIf _ rhs) = lGRHSCtOrigin rhs
-exprCtOrigin (HsLet _ _ e) = lexprCtOrigin e
+exprCtOrigin (HsLet _ _ _ _ e) = lexprCtOrigin e
exprCtOrigin (HsDo {}) = DoOrigin
exprCtOrigin (RecordCon {}) = Shouldn'tHappenOrigin "record construction"
exprCtOrigin (RecordUpd {}) = Shouldn'tHappenOrigin "record update"
diff --git a/compiler/GHC/Tc/Utils/Zonk.hs b/compiler/GHC/Tc/Utils/Zonk.hs
index b7d6f9cd27..ab6f94d033 100644
--- a/compiler/GHC/Tc/Utils/Zonk.hs
+++ b/compiler/GHC/Tc/Utils/Zonk.hs
@@ -854,10 +854,10 @@ zonkExpr env (HsMultiIf ty alts)
; expr' <- zonkLExpr env' expr
; return $ GRHS x guard' expr' }
-zonkExpr env (HsLet x binds expr)
+zonkExpr env (HsLet x tkLet binds tkIn expr)
= do (new_env, new_binds) <- zonkLocalBinds env binds
new_expr <- zonkLExpr new_env expr
- return (HsLet x new_binds new_expr)
+ return (HsLet x tkLet new_binds tkIn new_expr)
zonkExpr env (HsDo ty do_or_lc (L l stmts))
= do (_, new_stmts) <- zonkStmts env zonkLExpr stmts
@@ -1031,10 +1031,10 @@ zonkCmd env (HsCmdIf x eCond ePred cThen cElse)
; new_cElse <- zonkLCmd env1 cElse
; return (HsCmdIf x new_eCond new_ePred new_cThen new_cElse) }
-zonkCmd env (HsCmdLet x binds cmd)
+zonkCmd env (HsCmdLet x tkLet binds tkIn cmd)
= do (new_env, new_binds) <- zonkLocalBinds env binds
new_cmd <- zonkLCmd new_env cmd
- return (HsCmdLet x new_binds new_cmd)
+ return (HsCmdLet x tkLet new_binds tkIn new_cmd)
zonkCmd env (HsCmdDo ty (L l stmts))
= do (_, new_stmts) <- zonkStmts env zonkLCmd stmts
diff --git a/compiler/GHC/ThToHs.hs b/compiler/GHC/ThToHs.hs
index edd5301907..419736167f 100644
--- a/compiler/GHC/ThToHs.hs
+++ b/compiler/GHC/ThToHs.hs
@@ -973,7 +973,7 @@ cvtl e = wrapLA (cvt e)
| otherwise = do { alts' <- mapM cvtpair alts
; return $ HsMultiIf noAnn alts' }
cvt (LetE ds e) = do { ds' <- cvtLocalDecs (text "a let expression") ds
- ; e' <- cvtl e; return $ HsLet noAnn ds' e'}
+ ; e' <- cvtl e; return $ HsLet noAnn noHsTok ds' noHsTok e'}
cvt (CaseE e ms) = do { e' <- cvtl e; ms' <- mapM (cvtMatch CaseAlt) ms
; th_origin <- getOrigin
; return $ HsCase noAnn e'
diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs
index 88f15515c8..7bf99f4fcd 100644
--- a/compiler/Language/Haskell/Syntax/Expr.hs
+++ b/compiler/Language/Haskell/Syntax/Expr.hs
@@ -478,7 +478,9 @@ data HsExpr p
-- For details on above see note [exact print annotations] in GHC.Parser.Annotation
| HsLet (XLet p)
+ !(LHsToken "let" p)
(HsLocalBinds p)
+ !(LHsToken "in" p)
(LHsExpr p)
-- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDo',
@@ -971,7 +973,9 @@ data HsCmd id
-- For details on above see note [exact print annotations] in GHC.Parser.Annotation
| HsCmdLet (XCmdLet id)
+ !(LHsToken "let" id)
(HsLocalBinds id) -- let(rec)
+ !(LHsToken "in" id)
(LHsCmd id)
-- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLet',
-- 'GHC.Parser.Annotation.AnnOpen' @'{'@,