summaryrefslogtreecommitdiff
path: root/compiler/typecheck
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2020-02-17 19:46:13 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-20 21:22:11 -0500
commit466e1ad5d54cb2e8a3b6f16904b873cad882a736 (patch)
tree8a63ad350cb42a2aef09e4e0229eb01f82afda41 /compiler/typecheck
parent8b76d4574d703ee66f346775d408220fdddb8155 (diff)
downloadhaskell-466e1ad5d54cb2e8a3b6f16904b873cad882a736.tar.gz
Use TTG for HsSplicedT constructor
The constructor HsSplicedT occurs only in the GhcTc pass. This enforces this fact statically via TTG.
Diffstat (limited to 'compiler/typecheck')
-rw-r--r--compiler/typecheck/TcHsSyn.hs2
-rw-r--r--compiler/typecheck/TcPatSyn.hs3
-rw-r--r--compiler/typecheck/TcSplice.hs2
3 files changed, 3 insertions, 4 deletions
diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs
index ea533d578e..cf69b279e2 100644
--- a/compiler/typecheck/TcHsSyn.hs
+++ b/compiler/typecheck/TcHsSyn.hs
@@ -795,7 +795,7 @@ zonkExpr env (HsTcBracketOut x wrap body bs)
zonk_b env' (PendingTcSplice n e) = do e' <- zonkLExpr env' e
return (PendingTcSplice n e')
-zonkExpr env (HsSpliceE _ (HsSplicedT s)) =
+zonkExpr env (HsSpliceE _ (XSplice (HsSplicedT s))) =
runTopSplice s >>= zonkExpr env
zonkExpr _ (HsSpliceE x s) = WARN( True, ppr s ) -- Should not happen
diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs
index 129a0e5f10..d43461745b 100644
--- a/compiler/typecheck/TcPatSyn.hs
+++ b/compiler/typecheck/TcPatSyn.hs
@@ -980,7 +980,6 @@ tcPatToExpr name args pat = go pat
go1 (SplicePat _ (HsSpliced _ _ (HsSplicedPat pat)))
= go1 pat
go1 (SplicePat _ (HsSpliced{})) = panic "Invalid splice variety"
- go1 (SplicePat _ (HsSplicedT{})) = panic "Invalid splice variety"
-- The following patterns are not invertible.
go1 p@(BangPat {}) = notInvertible p -- #14112
@@ -993,7 +992,7 @@ tcPatToExpr name args pat = go pat
go1 p@(SplicePat _ (HsTypedSplice {})) = notInvertible p
go1 p@(SplicePat _ (HsUntypedSplice {})) = notInvertible p
go1 p@(SplicePat _ (HsQuasiQuote {})) = notInvertible p
- go1 p@(SplicePat _ (XSplice {})) = notInvertible p
+ go1 (SplicePat _ (XSplice nec)) = noExtCon nec
notInvertible p = Left (not_invertible_msg p)
diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs
index ed9895074b..390e088836 100644
--- a/compiler/typecheck/TcSplice.hs
+++ b/compiler/typecheck/TcSplice.hs
@@ -641,7 +641,7 @@ tcTopSplice expr res_ty
; lcl_env <- getLclEnv
; let delayed_splice
= DelayedSplice lcl_env expr res_ty q_expr
- ; return (HsSpliceE noExtField (HsSplicedT delayed_splice))
+ ; return (HsSpliceE noExtField (XSplice (HsSplicedT delayed_splice)))
}