[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 7 commits: Fix unusable units and module reexport interaction (#21097)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Nov 16 23:02:39 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
cee81370 by Sylvain Henry at 2023-11-16T09:57:46-05:00
Fix unusable units and module reexport interaction (#21097)

This commit fixes an issue with ModUnusable introduced in df0f148feae.

In mkUnusableModuleNameProvidersMap we traverse the list of unusable
units and generate ModUnusable origin for all the modules they contain:
exposed modules, hidden modules, and also re-exported modules. To do
this we have a two-level map:

  ModuleName -> Unit:ModuleName (aka Module) -> ModuleOrigin

So for each module name "M" in broken unit "u" we have:
  "M" -> u:M -> ModUnusable reason

However in the case of module reexports we were using the *target*
module as a key. E.g. if "u:M" is a reexport for "X" from unit "o":
   "M" -> o:X -> ModUnusable reason

Case 1: suppose a reexport without module renaming (u:M -> o:M) from
unusable unit u:
   "M" -> o:M -> ModUnusable reason

Here it's claiming that the import of M is unusable because a reexport
from u is unusable. But if unit o isn't unusable we could also have in
the map:
   "M" -> o:M -> ModOrigin ...

Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
(ModUnusable <> ModOrigin)

Case 2: similarly we could have 2 unusable units reexporting the same module
without renaming, say (u:M -> o:M) and (v:M -> o:M) with u and v
unusable. It gives:

  "M" -> o:M -> ModUnusable ... (for u)
  "M" -> o:M -> ModUnusable ... (for v)

Issue: the Semigroup instance of ModuleOrigin doesn't handle the case
(ModUnusable <> ModUnusable).

This led to #21097, #16996, #11050.

To fix this, in this commit we make ModUnusable track whether the module
used as key is a reexport or not (for better error messages) and we use
the re-export module as key. E.g. if "u:M" is a reexport for "o:X" and u
is unusable, we now record:

    "M" -> u:M -> ModUnusable reason reexported=True

So now, we have two cases for a reexport u:M -> o:X:
   - u unusable: "M" -> u:M -> ModUnusable ... reexported=True
   - u usable:   "M" -> o:X -> ModOrigin   ... reexportedFrom=u:M

The second case is indexed with o:X because in this case the Semigroup
instance of ModOrigin is used to combine valid expositions of a module
(directly or via reexports).

Note that module lookup functions select usable modules first (those who
have a ModOrigin value), so it doesn't matter if we add new ModUnusable
entries in the map like this:

  "M" -> {
    u:M -> ModUnusable ... reexported=True
    o:M -> ModOrigin ...
  }

The ModOrigin one will be used. Only if there is no ModOrigin or
ModHidden entry will the ModUnusable error be printed. See T21097 for an
example printing several reasons why an import is unusable.

- - - - -
3e606230 by Krzysztof Gogolewski at 2023-11-16T09:58:22-05:00
Fix IPE test

A helper function was defined in a different module than used.
To reproduce: ./hadrian/build test --test-root-dirs=testsuite/tests/rts/ipe

- - - - -
5aa02dc4 by Andreas Klebinger at 2023-11-16T18:01:52-05:00
Properly compute unpacked sizes for -funpack-small-strict-fields.

Use rep size rather than rep count to compute the size.

Fixes #22309

- - - - -
4353ce25 by James Henri Haydon at 2023-11-16T18:01:56-05:00
Explicit methods for Alternative Compose

Explicitly define some and many in Alternative instance for
Data.Functor.Compose

Implementation of https://github.com/haskell/core-libraries-committee/issues/181

- - - - -
d2b862b0 by Ignat Insarov at 2023-11-16T18:02:02-05:00
Add permutations for non-empty lists.

Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837

- - - - -
91d1c2fa by Andrew Lelechenko at 2023-11-16T18:02:02-05:00
Update changelog and since annotations for Data.List.NonEmpty.permutations

Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/68#issuecomment-1221409837

- - - - -
3c1959b3 by Oleg Alexander at 2023-11-16T18:02:05-05:00
Update doc string for traceShow

Updated doc string for traceShow.

- - - - -


30 changed files:

- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Errors/Types.hs
- compiler/GHC/Types/Id/Make.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/Finder/Types.hs
- compiler/GHC/Unit/State.hs
- docs/users_guide/9.10.1-notes.rst
- docs/users_guide/using-optimisation.rst
- libraries/base/changelog.md
- libraries/base/src/Data/Functor/Compose.hs
- libraries/base/src/Data/List/NonEmpty.hs
- libraries/base/src/Debug/Trace.hs
- + testsuite/tests/driver/T21097/Makefile
- + testsuite/tests/driver/T21097/T21097.stderr
- + testsuite/tests/driver/T21097/Test.hs
- + testsuite/tests/driver/T21097/all.T
- + testsuite/tests/driver/T21097/pkgdb/a.conf
- + testsuite/tests/driver/T21097/pkgdb/b.conf
- + testsuite/tests/driver/T21097/pkgdb/c.conf
- + testsuite/tests/driver/T21097b/Makefile
- + testsuite/tests/driver/T21097b/T21097b.stdout
- + testsuite/tests/driver/T21097b/Test.hs
- + testsuite/tests/driver/T21097b/all.T
- + testsuite/tests/driver/T21097b/pkgdb/a.conf
- + testsuite/tests/driver/T21097b/pkgdb/b.conf
- + testsuite/tests/driver/T21097b/pkgdb/c.conf
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/17924162f6d59ba32b22871b2abad7985d75e3b4...3c1959b3850452547aa59ced8d94c32121c77d37

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/17924162f6d59ba32b22871b2abad7985d75e3b4...3c1959b3850452547aa59ced8d94c32121c77d37
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/20231116/17481075/attachment.html>


More information about the ghc-commits mailing list