diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2022-03-12 01:08:00 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-18 05:10:58 -0400 |
commit | b056adc8062b4fe015450a21eb70e32dcf7023f5 (patch) | |
tree | a29805d0c2ea73000497eeea311e77ce961d0a3c /utils | |
parent | 4a2567f5641a4807584c90015dfc40a791f241b4 (diff) | |
download | haskell-b056adc8062b4fe015450a21eb70e32dcf7023f5.tar.gz |
TTG: Make HsQuote GhcTc isomorphic to NoExtField
An untyped bracket `HsQuote p` can never be constructed with
`p ~ GhcTc`. This is because we don't typecheck `HsQuote` at all.
That's OK, because we also never use `HsQuote GhcTc`.
To enforce this at the type level we make `HsQuote GhcTc` isomorphic
to `NoExtField` and impossible to construct otherwise, by using TTG field
extensions to make all constructors, except for `XQuote` (which takes `NoExtField`),
unconstructable, with `DataConCantHappen`
This is explained more in detail in Note [The life cycle of a TH quotation]
Related discussion: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4782
Diffstat (limited to 'utils')
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index f5ff05bb1b..3b6a0ba148 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -2035,7 +2035,7 @@ instance ExactPrint (HsExpr GhcPs) where markEpAnn an AnnCloseS -- ']' - exact (HsTypedBracket an (TExpBr _ e)) = do + exact (HsTypedBracket an e) = do markLocatedAALS an id AnnOpen (Just "[||") markLocatedAALS an id AnnOpenE (Just "[e||") markAnnotated e @@ -2070,8 +2070,6 @@ instance ExactPrint (HsExpr GhcPs) where markAnnotated e - -- exact x@(HsRnBracketOut{}) = withPpr x - -- exact x@(HsTcBracketOut{}) = withPpr x exact (HsSpliceE _ sp) = markAnnotated sp exact (HsProc an p c) = do |