[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: Compute all emitted diagnostic codes

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Aug 8 21:36:43 UTC 2023



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


Commits:
5769758a by sheaf at 2023-08-08T17:36:35-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).

- - - - -
8e71a324 by Fraser Tweedale at 2023-08-08T17:36:40-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

- - - - -
c32fedcd by Alan Zimmerman at 2023-08-08T17:36:40-04:00
EPA: Remove Location from WarningTxt source

This is not needed.

- - - - -


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
- 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
- + testsuite/tests/diagnostic-codes/Makefile
- + testsuite/tests/diagnostic-codes/all.T
- + testsuite/tests/diagnostic-codes/codes.stdout


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2c4f3f66ca75a9e77ecb0982eef408ea655db50b...c32fedcd69fe7047413bd9460265e37b1c5d2da0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2c4f3f66ca75a9e77ecb0982eef408ea655db50b...c32fedcd69fe7047413bd9460265e37b1c5d2da0
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/20230808/b6f3aff3/attachment.html>


More information about the ghc-commits mailing list