[Git][ghc/ghc][wip/restore-lcl-env] 21 commits: Turn "ambiguous import" error into a panic

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Tue May 16 12:52:20 UTC 2023



Matthew Pickering pushed to branch wip/restore-lcl-env at Glasgow Haskell Compiler / GHC


Commits:
5b9e9300 by sheaf at 2023-05-15T11:26:59-04:00
Turn "ambiguous import" error into a panic

This error should never occur, as a lookup of a type or data constructor
should never be ambiguous. This is because a single module cannot export
multiple Names with the same OccName, as per item (1) of
Note [Exporting duplicate declarations] in GHC.Tc.Gen.Export.

This code path was intended to handle duplicate record fields, but the
rest of the code had since been refactored to handle those in a
different way.

We also remove the AmbiguousImport constructor of IELookupError, as
it is no longer used.

Fixes #23302

- - - - -
e305e60c by M Farkas-Dyck at 2023-05-15T11:27:41-04:00
Unbreak some tests with latest GNU grep, which now warns about stray '\'.

Confusingly, the testsuite mangled the error to say "stray /".

We also migrate some tests from grep to grep -E, as it seems the author actually wanted an "POSIX extended" (a.k.a. sane) regex.

Background: POSIX specifies 2 "regex" syntaxen: "basic" and "extended". Of these, only "extended" syntax is actually a regular expression. Furthermore, "basic" syntax is inconsistent in its use of the '\' character — sometimes it escapes a regex metacharacter, but sometimes it unescapes it, i.e. it makes an otherwise normal character become a metacharacter. This baffles me and it seems also the authors of these tests. Also, the regex(7) man page (at least on Linux) says "basic" syntax is obsolete. Nearly all modern tools and libraries are consistent in this use of the '\' character (of which many use "extended" syntax by default).

- - - - -
5ae81842 by sheaf at 2023-05-15T14:49:17-04:00
Improve "ambiguous occurrence" error messages

This error was sometimes a bit confusing, especially when data families
were involved. This commit improves the general presentation of the
"ambiguous occurrence" error, and adds a bit of extra context in the
case of data families.

Fixes #23301

- - - - -
2f571afe by Sylvain Henry at 2023-05-15T14:50:07-04:00
Fix GHCJS OS platform (fix #23346)

- - - - -
86aae570 by Oleg Grenrus at 2023-05-15T14:50:43-04:00
Split DynFlags structure into own module

This will allow to make command line parsing to depend on
diagnostic system (which depends on dynflags)

- - - - -
fbe3fe00 by Josh Meredith at 2023-05-15T18:01:43-04:00
Replace the implementation of CodeBuffers with unboxed types

- - - - -
21f3aae7 by Josh Meredith at 2023-05-15T18:01:43-04:00
Use unboxed codebuffers in base

Metric Decrease:
    encodingAllocations

- - - - -
18ea2295 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Weak pointer cleanups

Various stylistic cleanups. No functional changes.

- - - - -
c343112f by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Don't force debug output to stderr

Previously `+RTS -Dw -l` would emit debug output to the eventlog while
`+RTS -l -Dw` would emit it to stderr. This was because the parser for
`-D` would unconditionally override the debug output target. Now we
instead only do so if no it is currently `TRACE_NONE`.

- - - - -
a5f5f067 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Forcibly flush eventlog on barf

Previously we would attempt to flush via `endEventLogging` which can
easily deadlock, e.g., if `barf` fails during GC.

Using `flushEventLog` directly may result in slightly less consistent
eventlog output (since we don't take all capabilities before flushing)
but avoids deadlocking.

- - - - -
73b1e87c by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Assert that pointers aren't cleared by -DZ

This turns many segmentation faults into much easier-to-debug assertion
failures by ensuring that LOOKS_LIKE_*_PTR checks recognize bit-patterns
produced by `+RTS -DZ` clearing as invalid pointers.

This is a bit ad-hoc but this is the debug runtime.

- - - - -
37fb61d8 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Introduce printGlobalThreads

- - - - -
451d65a6 by Ben Gamari at 2023-05-15T18:02:20-04:00
rts: Don't sanity-check StgTSO.global_link

See Note [Avoid dangling global_link pointers].

Fixes #19146.

- - - - -
d69cbd78 by sheaf at 2023-05-15T18:03:00-04:00
Split up tyThingToIfaceDecl from GHC.Iface.Make

This commit moves tyThingToIfaceDecl and coAxiomToIfaceDecl
from GHC.Iface.Make into GHC.Iface.Decl.
This avoids GHC.Types.TyThing.Ppr, which needs tyThingToIfaceDecl,
transitively depending on e.g. GHC.Iface.Load and GHC.Tc.Utils.Monad.

- - - - -
4d29ecdf by sheaf at 2023-05-15T18:03:00-04:00
Migrate errors to diagnostics in GHC.Tc.Module

This commit migrates the errors in GHC.Tc.Module to use the new
diagnostic infrastructure.

It required a significant overhaul of the compatibility checks between
an hs-boot or signature module and its implementation; we now use
a Writer monad to accumulate errors; see the BootMismatch datatype
in GHC.Tc.Errors.Types, with its panoply of subtypes.
For the sake of readability, several local functions inside the
'checkBootTyCon' function were split off into top-level functions.

We split off GHC.Types.HscSource into a "boot or sig" vs "normal hs file"
datatype, as this mirrors the logic in several other places where we
want to treat hs-boot and hsig files in a similar fashion.

This commit also refactors the Backpack checks for type synonyms
implementing abstract data, to correctly reject implementations that
contain qualified or quantified types (this fixes #23342 and #23344).

- - - - -
d986c98e by Rodrigo Mesquita at 2023-05-16T00:14:04-04:00
configure: Drop unused AC_PROG_CPP

In configure, we were calling `AC_PROG_CPP` but never making use of the
$CPP variable it sets or reads.

The issue is $CPP will show up in the --help output of configure,
falsely advertising a configuration option that does nothing.

The reason we don't use the $CPP variable is because HS_CPP_CMD is
expected to be a single command (without flags), but AC_PROG_CPP, when
CPP is unset, will set said variable to something like `/usr/bin/gcc -E`.
Instead, we configure HS_CPP_CMD through $CC.

- - - - -
a8f0435f by Cheng Shao at 2023-05-16T00:14:42-04:00
rts: fix --disable-large-address-space

This patch moves
ACQUIRE_ALLOC_BLOCK_SPIN_LOCK/RELEASE_ALLOC_BLOCK_SPIN_LOCK from
Storage.h to HeapAlloc.h. When --disable-large-address-space is passed
to configure, the code in HeapAlloc.h makes use of these two macros.
Fixes #23385.

- - - - -
bdb93cd2 by Oleg Grenrus at 2023-05-16T07:59:21+03:00
Add -Wmissing-role-annotations

Implements #22702

- - - - -
41ecfc34 by Ben Gamari at 2023-05-16T07:28:15-04:00
base: Export {get,set}ExceptionFinalizer from System.Mem.Weak

As proposed in CLC Proposal #126 [1].

[1]: https://github.com/haskell/core-libraries-committee/issues/126

- - - - -
67330303 by Ben Gamari at 2023-05-16T07:28:16-04:00
base: Introduce printToHandleFinalizerExceptionHandler

- - - - -
fc2d8ae7 by Matthew Pickering at 2023-05-16T13:51:36+01:00
Use setSrcSpan rather than setLclEnv in solveForAll

TODO

Fixes #23390

- - - - -


24 changed files:

- compiler/GHC/Core/Opt/CallerCC.hs
- compiler/GHC/Core/Opt/Monad.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Data/IOEnv.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Config/Diagnostic.hs
- compiler/GHC/Driver/Config/Logger.hs
- + compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Env.hs
- compiler/GHC/Driver/Env/Types.hs
- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/Driver/Errors/Types.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Hooks.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Ppr.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/HsToCore/Errors/Types.hs
- + compiler/GHC/Iface/Decl.hs
- compiler/GHC/Iface/Load.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f8d5fe2522c0bcbb21d9de77004134309cdfe282...fc2d8ae7e89c954758c5c025431f23cb39e84419

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f8d5fe2522c0bcbb21d9de77004134309cdfe282...fc2d8ae7e89c954758c5c025431f23cb39e84419
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/20230516/e0a7c2bb/attachment-0001.html>


More information about the ghc-commits mailing list