summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorromes <rodrigo.m.mesquita@gmail.com>2022-03-10 20:02:36 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-18 05:10:58 -0400
commit310890a51372937afa69e1edac1179eba67ac046 (patch)
treea69e155c1f7bf29d3a2a4c5d2f0c394e1dfdf06f /utils
parent19163397000ae3ce9886a75bef900d35774d864e (diff)
downloadhaskell-310890a51372937afa69e1edac1179eba67ac046.tar.gz
Separate constructors for typed and untyped brackets
Split HsBracket into HsTypedBracket and HsUntypedBracket. Unfortunately, we still cannot get rid of instance XXTypedBracket GhcTc = HsTypedBracket GhcRn despite no longer requiring it for typechecking, but rather because the TH desugarer works on GhcRn rather than GhcTc (See GHC.HsToCore.Quote)
Diffstat (limited to 'utils')
-rw-r--r--utils/check-exact/ExactPrint.hs26
1 files changed, 14 insertions, 12 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index ee8130df3a..f5ff05bb1b 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -1845,7 +1845,8 @@ instance ExactPrint (HsExpr GhcPs) where
getAnnotationEntry (HsProjection an _) = fromAnn an
getAnnotationEntry (ExprWithTySig an _ _) = fromAnn an
getAnnotationEntry (ArithSeq an _ _) = fromAnn an
- getAnnotationEntry (HsBracket an _) = fromAnn an
+ getAnnotationEntry (HsTypedBracket an _) = fromAnn an
+ getAnnotationEntry (HsUntypedBracket an _) = fromAnn an
getAnnotationEntry (HsSpliceE an _) = fromAnn an
getAnnotationEntry (HsProc an _ _) = fromAnn an
getAnnotationEntry (HsStatic an _) = fromAnn an
@@ -2034,26 +2035,32 @@ instance ExactPrint (HsExpr GhcPs) where
markEpAnn an AnnCloseS -- ']'
- exact (HsBracket an (ExpBr _ e)) = do
+ exact (HsTypedBracket an (TExpBr _ e)) = do
+ markLocatedAALS an id AnnOpen (Just "[||")
+ markLocatedAALS an id AnnOpenE (Just "[e||")
+ markAnnotated e
+ markLocatedAALS an id AnnClose (Just "||]")
+
+ exact (HsUntypedBracket an (ExpBr _ e)) = do
markEpAnn an AnnOpenEQ -- "[|"
markEpAnn an AnnOpenE -- "[e|" -- optional
markAnnotated e
markEpAnn an AnnCloseQ -- "|]"
- exact (HsBracket an (PatBr _ e)) = do
+ exact (HsUntypedBracket an (PatBr _ e)) = do
markLocatedAALS an id AnnOpen (Just "[p|")
markAnnotated e
markEpAnn an AnnCloseQ -- "|]"
- exact (HsBracket an (DecBrL _ e)) = do
+ exact (HsUntypedBracket an (DecBrL _ e)) = do
markLocatedAALS an id AnnOpen (Just "[d|")
markAnnotated e
markEpAnn an AnnCloseQ -- "|]"
- -- -- exact (HsBracket an (DecBrG _ _)) =
+ -- -- exact (HsUntypedBracket an (DecBrG _ _)) =
-- -- traceM "warning: DecBrG introduced after renamer"
- exact (HsBracket an (TypBr _ e)) = do
+ exact (HsUntypedBracket an (TypBr _ e)) = do
markLocatedAALS an id AnnOpen (Just "[t|")
markAnnotated e
markEpAnn an AnnCloseQ -- "|]"
- exact (HsBracket an (VarBr _ b e)) = do
+ exact (HsUntypedBracket an (VarBr _ b e)) = do
if b
then do
markEpAnn an AnnSimpleQuote
@@ -2061,11 +2068,6 @@ instance ExactPrint (HsExpr GhcPs) where
else do
markEpAnn an AnnThTyQuote
markAnnotated e
- exact (HsBracket an (TExpBr _ e)) = do
- markLocatedAALS an id AnnOpen (Just "[||")
- markLocatedAALS an id AnnOpenE (Just "[e||")
- markAnnotated e
- markLocatedAALS an id AnnClose (Just "||]")
-- exact x@(HsRnBracketOut{}) = withPpr x