diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-06-10 16:04:26 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-02 01:36:32 -0400 |
commit | f1a782dd29480c4570465ea0aa06008bbf444e13 (patch) | |
tree | 4837a90b7d2e3e1786aa19d75d1d5db5e834f1cf /compiler/GHC/Hs | |
parent | 7445bd714c1bea39207f9a2fa497c325b95ba2c7 (diff) | |
download | haskell-f1a782dd29480c4570465ea0aa06008bbf444e13.tar.gz |
HsToken for let/in (#19623)
One more step towards the new design of EPA.
Diffstat (limited to 'compiler/GHC/Hs')
-rw-r--r-- | compiler/GHC/Hs/Dump.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Hs/Expr.hs | 18 | ||||
-rw-r--r-- | compiler/GHC/Hs/Syn/Type.hs | 2 |
3 files changed, 11 insertions, 17 deletions
diff --git a/compiler/GHC/Hs/Dump.hs b/compiler/GHC/Hs/Dump.hs index e059cda6b9..5ba1df580b 100644 --- a/compiler/GHC/Hs/Dump.hs +++ b/compiler/GHC/Hs/Dump.hs @@ -57,12 +57,12 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 `extQ` annotationAddEpAnn `extQ` annotationGrhsAnn `extQ` annotationEpAnnHsCase - `extQ` annotationEpAnnHsLet `extQ` annotationAnnList `extQ` annotationEpAnnImportDecl `extQ` annotationAnnParen `extQ` annotationTrailingAnn `extQ` annotationEpaLocation + `extQ` annotationNoEpAnns `extQ` addEpAnn `extQ` lit `extQ` litr `extQ` litt `extQ` sourceText @@ -242,9 +242,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") @@ -260,6 +257,9 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 annotationEpaLocation :: EpAnn EpaLocation -> SDoc annotationEpaLocation = annotation' (text "EpAnn EpaLocation") + annotationNoEpAnns :: EpAnn NoEpAnns -> SDoc + annotationNoEpAnns = annotation' (text "EpAnn NoEpAnns") + annotation' :: forall a .(Data a, Typeable a) => SDoc -> EpAnn a -> SDoc annotation' tag anns = case ba of diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs index 4e2dfc9316..eb51021b83 100644 --- a/compiler/GHC/Hs/Expr.hs +++ b/compiler/GHC/Hs/Expr.hs @@ -311,7 +311,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 @@ -390,12 +390,6 @@ data AnnExplicitSum aesClose :: EpaLocation } deriving Data -data AnnsLet - = AnnsLet { - alLet :: EpaLocation, - alIn :: EpaLocation - } deriving Data - data AnnFieldLabel = AnnFieldLabel { afDot :: Maybe EpaLocation @@ -629,11 +623,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)] @@ -1101,7 +1095,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 @@ -1187,11 +1181,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 f260a4c19b..1501abbb9e 100644 --- a/compiler/GHC/Hs/Syn/Type.hs +++ b/compiler/GHC/Hs/Syn/Type.hs @@ -112,7 +112,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 |