[Git][ghc/ghc][wip/T23818] 5 commits: Compute all emitted diagnostic codes

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Wed Aug 9 15:33:24 UTC 2023



Ben Gamari pushed to branch wip/T23818 at Glasgow Haskell Compiler / GHC


Commits:
0ef1d8ae by sheaf at 2023-08-08T21:26:51-04:00
Compute all emitted diagnostic codes

This commit introduces in GHC.Types.Error.Codes the function

  constructorCodes :: forall diag. (...) => Map DiagnosticCode String

which computes a collection of all the diagnostic codes that correspond
to a particular type. In particular, we can compute the collection of
all diagnostic codes emitted by GHC using the invocation

  constructorCodes @GhcMessage

We then make use of this functionality in the new "codes" test which
checks consistency and coverage of GHC diagnostic codes.
It performs three checks:

  - check 1: all non-outdated GhcDiagnosticCode equations
    are statically used.
  - check 2: all outdated GhcDiagnosticCode equations
    are statically unused.
  - check 3: all statically used diagnostic codes are covered by
    the testsuite (modulo accepted exceptions).

- - - - -
4bc7b1e5 by Fraser Tweedale at 2023-08-08T21:27:32-04:00
numberToRangedRational: fix edge cases for exp ≈ (maxBound :: Int)

Currently a negative exponent less than `minBound :: Int` results in
Infinity, which is very surprising and obviously wrong.

```
λ> read "1e-9223372036854775808" :: Double
0.0
λ> read "1e-9223372036854775809" :: Double
Infinity
```

There is a further edge case where the exponent can overflow when
increased by the number of tens places in the integer part, or
underflow when decreased by the number of leading zeros in the
fractional part if the integer part is zero:

```
λ> read "10e9223372036854775807" :: Double
0.0
λ> read "0.01e-9223372036854775808" :: Double
Infinity
```

To resolve both of these issues, perform all arithmetic and
comparisons involving the exponent in type `Integer`.  This approach
also eliminates the need to explicitly check the exponent against
`maxBound :: Int` and `minBound :: Int`, because the allowed range
of the exponent (i.e. the result of `floatRange` for the target
floating point type) is certainly within those bounds.

This change implements CLC proposal 192:
https://github.com/haskell/core-libraries-committee/issues/192

- - - - -
6eab07b2 by Alan Zimmerman at 2023-08-08T21:28:10-04:00
EPA: Remove Location from WarningTxt source

This is not needed.

- - - - -
68889cac by Ben Gamari at 2023-08-09T11:33:17-04:00
users-guide: Support both distutils and packaging

As noted in #23818, some old distributions (e.g. Debian 9) only include
`distutils` while newer distributions only include `packaging`.

Fixes #23818.

- - - - -
1cdb4044 by Ben Gamari at 2023-08-09T11:33:17-04:00
users-guide: Ensure extlinks is compatible with Sphinx <4

The semantics of the `extlinks` attribute annoyingly changed in Sphinx
4. Reflect this in our configuration. See #22690.

Fixes #23807.

- - - - -


30 changed files:

- compiler/GHC/Driver/Errors/Ppr.hs
- compiler/GHC/HsToCore/Errors/Ppr.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Make.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Types/Error.hs
- compiler/GHC/Types/Error/Codes.hs
- compiler/GHC/Unit/Module/Warnings.hs
- docs/users_guide/flags.py
- docs/users_guide/ghc_config.py.in
- docs/users_guide/utils.py
- hadrian/src/Packages.hs
- hadrian/src/Rules/Test.hs
- hadrian/src/Settings/Default.hs
- libraries/base/Text/Read/Lex.hs
- libraries/base/changelog.md
- libraries/base/tests/all.T
- + libraries/base/tests/read-float-double.hs
- + libraries/base/tests/read-float-double.stdout
- + linters/lint-codes/LintCodes/Coverage.hs
- + linters/lint-codes/LintCodes/Static.hs
- + linters/lint-codes/Main.hs
- + linters/lint-codes/Makefile
- + linters/lint-codes/cabal.project
- + linters/lint-codes/ghc.mk
- + linters/lint-codes/lint-codes.cabal
- testsuite/mk/boilerplate.mk


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/59eb1e30746c06267a3c70708f2f8e4c58544358...1cdb4044b321141c2fb4b8635395eb47a582ee29

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/59eb1e30746c06267a3c70708f2f8e4c58544358...1cdb4044b321141c2fb4b8635395eb47a582ee29
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/20230809/0309d52a/attachment-0001.html>


More information about the ghc-commits mailing list