X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcSplice.lhs;h=7c3aa8637ab2574ecf0726846f22f3593d6787ad;hb=7d44782fdfab8c280ae8de1846cb40a78b6edb95;hp=2215c9bfb4e506051038376f4bfd901e25e83313;hpb=ab4bc0f16200a9d26272a9fcf21e669d6d19761d;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs index 2215c9b..7c3aa86 100644 --- a/compiler/typecheck/TcSplice.lhs +++ b/compiler/typecheck/TcSplice.lhs @@ -421,7 +421,16 @@ instance TH.Quasi (IOEnv (Env TcGblEnv TcLclEnv)) where qCurrentModule = do { m <- getModule; return (moduleString m) } qReify v = reify v - qRecover = recoverM + + -- For qRecover, discard error messages if + -- the recovery action is chosen. Otherwise + -- we'll only fail higher up. c.f. tryTcLIE_ + qRecover recover main = do { (msgs, mb_res) <- tryTcErrs main + ; case mb_res of + Just val -> do { addMessages msgs -- There might be warnings + ; return val } + Nothing -> recover -- Discard all msgs + } qRunIO io = ioToTcRn io \end{code}