summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/typecheck/TcSplice.lhs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs
index 21a6b7ef87..c5f0af3ff1 100644
--- a/compiler/typecheck/TcSplice.lhs
+++ b/compiler/typecheck/TcSplice.lhs
@@ -497,6 +497,12 @@ tcTopSpliceExpr :: TcM (LHsExpr Id) -> TcM (LHsExpr Id)
tcTopSpliceExpr tc_action
= checkNoErrs $ -- checkNoErrs: must not try to run the thing
-- if the type checker fails!
+ unsetDOptM Opt_DeferTypeErrors $
+ -- Don't defer type errors. Not only are we
+ -- going to run this code, but we do an unsafe
+ -- coerce, so we get a seg-fault if, say we
+ -- splice a type into a place where an expression
+ -- is expected (Trac #7276)
setStage Splice $
do { -- Typecheck the expression
(expr', lie) <- captureConstraints tc_action