[Git][ghc/ghc][wip/romes/exceptions-propagate] 5 commits: Remove redundant CallStack from exceptions

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Tue Oct 1 15:14:11 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/exceptions-propagate at Glasgow Haskell Compiler / GHC


Commits:
9e0cebe8 by Rodrigo Mesquita at 2024-10-01T16:05:02+01:00
Remove redundant CallStack from exceptions

Before the exception backtraces proposal was implemented, ErrorCall
accumulated its own callstack via HasCallStack constraints, but
ExceptionContext is now accumulated automatically.

The original ErrorCall mechanism is now redundant and we get a duplicate
CallStack

CLC proposal#285

Fixes #25283

- - - - -
cc61ea80 by Rodrigo Mesquita at 2024-10-01T16:13:12+01:00
Freeze call stack in error throwing functions

CLC proposal#285

- - - - -
6219a5b1 by Rodrigo Mesquita at 2024-10-01T16:13:19+01:00
De-duplicate displayContext and displayExceptionContext

The former was unused except for one module where it was essentially
re-defining displayExceptionContext.

Moreover, this commit extends the fix from
bfe600f5bb3ecd2c8fa71c536c63d3c46984e3f8 to displayExceptionContext too,
which was missing.

- - - - -
39e91345 by Rodrigo Mesquita at 2024-10-01T16:13:19+01:00
Re-export NoBacktrace from Control.Exception

This was originally proposed and accepted in section
    "2.7   Capturing Backtraces on Exceptions"
of the CLC proposal for exception backtraces.

However, the implementation missed this re-export, which this commit now
fixes.

- - - - -
1186c66c by Rodrigo Mesquita at 2024-10-01T16:13:20+01:00
Fix exception backtraces from GHCi

When running the program with `runhaskell`/`runghc` the backtrace should
match the backtrace one would get by compiling and running the program.
But currently, an exception thrown in a program interpreted with
`runhaskell` will:

    * Not include the original exception backtrace at all
    * Include the backtrace from the internal GHCi/ghc rethrowing of the
      original exception

This commit fixes this divergence by not annotating the ghc(i) backtrace
(with NoBacktrace) and making sure that the backtrace of the original
exception is serialized across the boundary and rethrown with the
appropriate context.

Fixes #25116

- - - - -


30 changed files:

- compiler/GHC/Utils/Panic/Plain.hs
- ghc/GHCi/UI/Monad.hs
- libraries/base/src/Control/Exception.hs
- libraries/base/src/GHC/Exception.hs
- libraries/base/src/GHC/Stack.hs
- libraries/base/tests/IO/T4808.stderr
- libraries/base/tests/IO/mkdirExists.stderr
- libraries/base/tests/IO/openFile002.stderr
- libraries/base/tests/IO/withBinaryFile001.stderr
- libraries/base/tests/IO/withFile001.stderr
- libraries/base/tests/IO/withFileBlocking001.stderr
- libraries/base/tests/T15349.stderr
- libraries/base/tests/T19288.stderr
- libraries/base/tests/T24807.stderr
- libraries/base/tests/all.T
- libraries/base/tests/assert.stderr
- − libraries/base/tests/topHandler04.hs
- − libraries/base/tests/topHandler04.stderr
- libraries/ghc-internal/src/GHC/Internal/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Context.hs
- libraries/ghc-internal/src/GHC/Internal/Exception/Type.hs
- libraries/ghc-internal/src/GHC/Internal/IO.hs
- libraries/ghc-internal/src/GHC/Internal/IO/Exception.hs
- libraries/ghc-internal/src/GHC/Internal/Stack.hs
- libraries/ghc-internal/src/GHC/Internal/Stack.hs-boot
- − libraries/ghc-internal/src/GHC/Internal/Stack/CCS.hs-boot
- libraries/ghci/GHCi/Message.hs
- libraries/ghci/GHCi/Run.hs
- testsuite/tests/annotations/should_fail/annfail12.stderr
- testsuite/tests/arityanal/should_run/T21694a.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/571aa8f3433cbc59cd43c4d9d072c1b9a6182e6b...1186c66cbef853505c0033534dbb4177d9c2d5e1

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/571aa8f3433cbc59cd43c4d9d072c1b9a6182e6b...1186c66cbef853505c0033534dbb4177d9c2d5e1
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20241001/eda99401/attachment.html>


More information about the ghc-commits mailing list