[Git][ghc/ghc][wip/romes/exceptions-propagate] 16 commits: users-guide: Document GHCi :where command
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Tue Oct 15 13:17:14 UTC 2024
Rodrigo Mesquita pushed to branch wip/romes/exceptions-propagate at Glasgow Haskell Compiler / GHC
Commits:
745dd590 by Ben Gamari at 2024-10-14T09:13:12-04:00
users-guide: Document GHCi :where command
Resolve #24509.
- - - - -
e9cc4699 by Alan Zimmerman at 2024-10-14T09:13:48-04:00
EPA: Remove [AddEpAnn] from IE, Pat and some Tys
EPA: Remove [AddEpAnn] from LazyPat
EPA: Remove [AddEpAnn] from RecordCon/RecordUpd/ConPat
EPA: Remove [AddEpAnn] from HsFieldBind
EPA: Remove [AddEpAnn] from PatSynBind
EPA: Remove [AddEpAnn] from IPBind
EPA: Remove [AddEpAnn] from FixSig
EPA: Remove [AddEpAnn] from activation rules
EPA: Remove [AddEpann] from SpecInstSig
EPA: Remove [AddEpAnn] from MinimalSig
EPA: Remove [AddEpAnn] from SCCFunSig
EPA: Remove [AddEpAnn] from CompleteMatchSig
EPA: Remove [AddEpAnn] from AnnSig, as used in PatSynSig, ClassOpSig, TypeSig
EPA: Remove [AddEpAnn] from IEThingAbs
EPA: Remove [AddEpAnn] from IEThingAll / IEThingWith
EPA: Remove [AddEpAnn] from IEModuleContents
EPA: Remove [AddEpAnn] from HsOpTy
EPA: Remove [AddEpAnn] for various binders
EPA: Remove [AddEpAnn] for HsIParamTy
- - - - -
81a570bf by Sebastian Graf at 2024-10-14T22:15:31-04:00
Desugaring, plus -Wincomplete-record-selectors
This commit does several related things:
* Major refactor of the handling of applications in the desugarer.
Now all applications are handled in `dsApp`, `ds_app` and related
functions. This dramatically simplifies the code and removes
complicated cruft that had accumulated. Hooray.
Fixes #25281.
* Improve the handling of -Wincomplete-record-selectors.
We now incorporate the result type of unsaturated record selector
applications as well as consider long-distance information in
getField applications.
Plus, the implmentation now builds the improved `dsApp` stuff
above, so it is much easier to understand.
Plus, incorporates improved error message wording suggested
by Adam Gundry in !12685.
Fixes #24824, #24891
See the long Note [Detecting incomplete record selectors]
* Add -Wincomplete-record-selectors to -Wall, as specified in
GHC Proposal 516.
To do this, I also had to add -Wno-incomplete-record-selectors
to the build flags for Cabal in GHC's CI. See
hadrian/src/Settings/Warnings.hs. We can remove this when
Cabal is updated so that it doesn't trigger the warning:
https://github.com/haskell/cabal/issues/10402
2.6% decrease in compile time allocation in RecordUpPerf
Metric Decrease:
RecordUpdPerf
- - - - -
ae7bc08e by Simon Peyton Jones at 2024-10-14T22:15:31-04:00
Elmininate incomplete record selectors
This patch is a pure refactor of GHC's source code, to avoid the use
of partial record selectors. It was provoked by adding
-Wincomplete-record-selectors to -Wall (as the GHC Proposal specified),
which in turn showed up lots of places where GHC was using incomplete
record selectors.
This patch does mostly-simple refactoring to make it clear to the pattern
match checker that there is in fact no partiality.
There is one externally-visible change: I changed the data type HoleFit
to split out the two cases
data HoleFit = TcHoleFit TcHoleFit | RawHoleFit SDoc
data TcHoleFit = HoleFit { ...lots of fields }
There are large swathes of code that just deal with `TcHoleFit`, and
having it as a separate data types makes it apparent that `RawHoleFit`
can't occur.
This makes it much better -- but the change is visible in the
HolePlugin interface. I decided that there are so few clients of this
API that it's worth the change.
I moved several functions from Language.Haskell.Syntax to GHC.Hs.
Reason, when instantiated at (GhcPass _), the extension data construtcor
is guaranteed unused, and that justifies omitted patterns in these
functions. By putting them in GHC.Hs.X I can specialise the type for
(GhcPass _) and thereby make the function total.
An interesting side-light is that there were a few local function
definitions without a type signature, like this one in GHC.Parser.Header
convImport (L _ i) = (ideclPkgQual i, reLoc $ ideclName i)
This is fully closed, and so is generalised; but that generalises
it to any old pass, not (GhcPass _), so GHC rightly complains about the
use of the selector `ideclPkgQual`. I added a type signature to `i`, thus
convImport (L _ (i::ImportDecl GhcPs))
= (ideclPkgQual i, reLoc $ ideclName i)
which specialised the function enough to make the record selector complete.
Quite a surprising consequence of local let-generalisation!
- - - - -
6a067226 by Simon Peyton Jones at 2024-10-14T22:15:31-04:00
Add -Werror=-Wno-error=incomplete-record-selectors to hadrian-multi
In the main MR, -Wall now includes -Wincomplete-record-selectors.
However `hadrian-multi` has many, many warnings about incomplete
record selectors, so this patch stops those warnings being treated
as errors. (See discussion on !13308.)
A better fix would be to remove the use of incomplete record
selectors, since each of them represents a potential crash.
- - - - -
edeafc14 by Ben Gamari at 2024-10-14T22:16:08-04:00
users-guide: Document field coalescence
- - - - -
55b83587 by ARATA Mizuki at 2024-10-14T22:16:49-04:00
LLVM backend: Use correct rounding for Float literals
Fixes #22033
- - - - -
0bc12c92 by Matthew Pickering at 2024-10-15T14:16:24+01:00
Exception rethrowing
Basic changes:
* Change `catch` function to propagate exceptions using the
WhileHandling mechanism.
* Introduce `catchNoPropagate`, which does the same as before, but
passes an exception which can be rethrown.
* Introduce `rethrowIO` combinator, which rethrows an exception with a
context and doesn't add a new backtrace.
* Introduce `tryWithContext` for a variant of `try` which can rethrow
the exception with it's original context.
* onException is modified to rethrow the original error rather than
creating a new callstack.
* Functions which rethrow in GHC.Internal.IO.Handle.FD,
GHC.Internal.IO.Handle.Internals, GHC.Internal.IO.Handle.Text, and
GHC.Internal.System.IO.Error are modified to not add a new callstack.
Implements CLC proposal#202 <https://github.com/haskell/core-libraries-committee/issues/202>
- - - - -
3ca1c173 by Rodrigo Mesquita at 2024-10-15T14:16:24+01:00
Add test for #25300
- - - - -
9abd0999 by Rodrigo Mesquita at 2024-10-15T14:16:25+01:00
exceptions: Improve the message layout as per #285
This commit fixes the layout of the additional information included when
displaying an exception, namely the type of the exception.
It also fixes the default handler's heading message to work well
together with the improved display message of SomeException.
CLC proposal#285
- - - - -
b51efaee by Rodrigo Mesquita at 2024-10-15T14:16:25+01:00
Display type and callstack of exception on handler
This commit changes the Exception instance of SomeException to *simply*
display the underlying exception in `displayException`. The augmented
exception message that included the type and backtrace of the exception
are now only printed on a call to `displayExceptionWithInfo`.
At a surface level, existing programs should behave the same since the
`uncaughtExceptionHandler`, which is responsible for printing out uncaught
exceptions to the user, will use `displayExceptionWithInfo` by default.
However, unlike the instance's `displayException` method, the
`uncaughtExceptionHandler` can be overriden with
`setUncaughtExceptionHandler`. This makes the extra information opt-in
without fixing it the instance, which can be valuable if your program
wants to display uncaught exceptions to users in a user-facing way
(ie without backtraces).
This is what was originally agreed for CLC#231 or CLC#261 with regard to
the type of the exception information.
The call stack also becoming part of the default handler rather than the
Exception instance is an ammendment to CLC#164.
Discussion of the ammendment is part of CLC#285.
- - - - -
2228bf1c by Rodrigo Mesquita at 2024-10-15T14:16:25+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
Updates Cabal submodule to fix their usage of ErrorCallWithLocation to ErrorCall
CLC proposal#285
Fixes #25283
- - - - -
a88c8e47 by Rodrigo Mesquita at 2024-10-15T14:16:25+01:00
Freeze call stack in error throwing functions
CLC proposal#285
- - - - -
f5dbcdbf by Rodrigo Mesquita at 2024-10-15T14:16:26+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.
- - - - -
a68fb87b by Rodrigo Mesquita at 2024-10-15T14:16:26+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.
- - - - -
68b4fe07 by Rodrigo Mesquita at 2024-10-15T14:16:26+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:
- .gitlab-ci.yml
- compiler/GHC/CmmToAsm/Dwarf/Types.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Stats.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/CmmToLlvm/Data.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/ConLike.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/LateCC/OverloadedCalls.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Extension.hs
- compiler/GHC/Hs/ImpExp.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b66cb06bc842e45ba39183cd7bd34d2186b92dbe...68b4fe075d2847f1ef7b49cd51a4cdcaff77c31a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/b66cb06bc842e45ba39183cd7bd34d2186b92dbe...68b4fe075d2847f1ef7b49cd51a4cdcaff77c31a
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/20241015/8294cc2f/attachment-0001.html>
More information about the ghc-commits
mailing list