[commit: ghc] ghc-8.2: Deal with exceptions in dsWhenNoErrs (c7642de)
git at git.haskell.org
git at git.haskell.org
Fri May 5 02:54:36 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.2
Link : http://ghc.haskell.org/trac/ghc/changeset/c7642debda55509d805036c28c9804f6c587d44b/ghc
>---------------------------------------------------------------
commit c7642debda55509d805036c28c9804f6c587d44b
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Thu May 4 13:33:04 2017 +0100
Deal with exceptions in dsWhenNoErrs
Gracious me. Ever since this patch
commit 374457809de343f409fbeea0a885877947a133a2
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date: Fri Jul 11 13:54:45 2014 +0200
Injective type families
TcRnMonad.askNoErrs has been wrong. It looked like this
askNoErrs :: TcRn a -> TcRn (a, Bool)
askNoErrs m
= do { errs_var <- newTcRef emptyMessages
; res <- setErrsVar errs_var m
; (warns, errs) <- readTcRef errs_var
; addMessages (warns, errs)
; return (res, isEmptyBag errs) }
The trouble comes if 'm' throws an exception in the TcRn monad.
Then 'errs_var is never read, so any errors are simply lost.
This mistake was then propgated into DsMonad.dsWhenNoErrs, where
it gave rise to Trac #13642.
Thank to Ryan for narrowing it down so sharply.
I did some refactoring, as usual.
(cherry picked from commit e77019767fe5327011c6dc8fe089c64884120aab)
>---------------------------------------------------------------
c7642debda55509d805036c28c9804f6c587d44b
compiler/deSugar/DsMonad.hs | 32 +++++++++---
compiler/ghci/RtClosureInspect.hs | 10 ++--
compiler/typecheck/TcRnDriver.hs | 2 +-
compiler/typecheck/TcRnMonad.hs | 102 +++++++++++++++++++-------------------
compiler/typecheck/TcSplice.hs | 8 +--
testsuite/tests/th/T13642.hs | 9 ++++
testsuite/tests/th/T13642.stderr | 4 ++
testsuite/tests/th/all.T | 1 +
8 files changed, 94 insertions(+), 74 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c7642debda55509d805036c28c9804f6c587d44b
More information about the ghc-commits
mailing list