Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/a501c950652d3cb56335781289f0f502c0cf2f4e >--------------------------------------------------------------- commit a501c950652d3cb56335781289f0f502c0cf2f4e Author: Simon Peyton Jones <simo...@microsoft.com> Date: Mon Oct 1 21:52:19 2012 +0100 Make sure that we check for type errors strictly in a Template Haskell splice, even if -fdefer-type-errors is on We're going to run this code, so there's no point in deferring type errors. Worse, TcSplice uses unsafeCoerce (for vevy good reasons), so splicing a type into a place where an expression is expected would yield a seg-fault if we plough on regardless. Fixes Trac #7276 >--------------------------------------------------------------- compiler/typecheck/TcSplice.lhs | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs index 21a6b7e..c5f0af3 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 _______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc