summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface
diff options
context:
space:
mode:
authorromes <rodrigo.m.mesquita@gmail.com>2022-03-11 16:51:09 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-18 05:10:58 -0400
commit4a2567f5641a4807584c90015dfc40a791f241b4 (patch)
tree632cd30d5a1d5be5536d4f30cadeaa347ce81382 /compiler/GHC/Iface
parent310890a51372937afa69e1edac1179eba67ac046 (diff)
downloadhaskell-4a2567f5641a4807584c90015dfc40a791f241b4.tar.gz
TTG: Refactor bracket for desugaring during tc
When desugaring a bracket we want to desugar /renamed/ rather than /typechecked/ code; So in (HsExpr GhcTc) tree, we must have a (HsExpr GhcRn) for the quotation itself. This commit reworks the TTG refactor on typed and untyped brackets by storing the /renamed/ code in the bracket field extension rather than in the constructor extension in `HsQuote` (previously called `HsUntypedBracket`) See Note [The life cycle of a TH quotation] and https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4782
Diffstat (limited to 'compiler/GHC/Iface')
-rw-r--r--compiler/GHC/Iface/Ext/Ast.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/compiler/GHC/Iface/Ext/Ast.hs b/compiler/GHC/Iface/Ext/Ast.hs
index c825c46a01..9ce99f3fdb 100644
--- a/compiler/GHC/Iface/Ext/Ast.hs
+++ b/compiler/GHC/Iface/Ext/Ast.hs
@@ -1184,10 +1184,10 @@ instance HiePass p => ToHie (LocatedA (HsExpr (GhcPass p))) where
[ toHie expr
]
HsTypedBracket xbracket b -> case hiePass @p of
- HieRn | _ <- xbracket ->
- [ toHie b
- ]
- HieTc | HsBracketTc _ _ p <- xbracket ->
+ HieRn ->
+ [ toHie b
+ ]
+ HieTc | HsBracketTc _ _ _ p <- xbracket ->
[ toHie b
, toHie p
]
@@ -1196,7 +1196,7 @@ instance HiePass p => ToHie (LocatedA (HsExpr (GhcPass p))) where
[ toHie b
, toHie p
]
- HieTc | HsBracketTc _ _ p <- xbracket ->
+ HieTc | HsBracketTc _ _ _ p <- xbracket ->
[ toHie b
, toHie p
]
@@ -1859,10 +1859,7 @@ instance ToHie (LocatedA (SpliceDecl GhcRn)) where
[ toHie splice
]
-instance ToHie (HsTypedBracket a) where
- toHie _ = pure []
-
-instance ToHie (HsUntypedBracket a) where
+instance ToHie (HsQuote a) where
toHie _ = pure []
instance ToHie PendingRnSplice where