[Git][ghc/ghc][wip/t22884] 3 commits: Allow API users to wrap error messages created during 'load'

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Thu May 11 06:14:18 UTC 2023



Matthew Pickering pushed to branch wip/t22884 at Glasgow Haskell Compiler / GHC


Commits:
fa26afc0 by Matthew Pickering at 2023-05-11T07:14:07+01:00
Allow API users to wrap error messages created during 'load'

This allows API users to configure how messages are rendered when they
are emitted from the load function. For an example see how
'loadWithCache' is used in GHCi.

- - - - -
d68100b8 by Matthew Pickering at 2023-05-11T07:14:07+01:00
Abstract cantFindError and turn Opt_BuildingCabal into a print-time option

* cantFindError is abstracted so that the parts which mention specific
  things about ghc/ghci are parameters. The intention being that
  GHC/GHCi can specify the right values to put here but otherwise
  display the same error message.
* The BuildingCabalPackage argument from GenericMissing is removed and
  turned into a print-time option. The reason for the error is not
  dependent on whether `-fbuilding-cabal-package` is passed, so we don't
  want to store that in the error message.

- - - - -
8d3c21ae by Matthew Pickering at 2023-05-11T07:14:07+01:00
error messages: Don't display ghci specific hints for missing packages

Tickets like #22884 suggest that it is confusing that GHC used on the
command line can suggest options which only work in GHCi.

This ticket uses the error message infrastructure to override certain
error messages which displayed GHCi specific information so that this
information is only showed when using GHCi.

The main annoyance is that we mostly want to display errors in the same
way as before, but with some additional information. This means that the
error rendering code has to be exported from the Iface/Errors/Ppr.hs
module.

I am unsure about whether the approach taken here is the best or most
maintainable solution.

Fixes #22884

- - - - -


30 changed files:

- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Config/Diagnostic.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Iface/Errors.hs
- compiler/GHC/Iface/Errors/Ppr.hs
- compiler/GHC/Iface/Errors/Types.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- docs/users_guide/9.8.1-notes.rst
- ghc/GHCi/UI.hs
- ghc/GHCi/UI/Exception.hs
- testsuite/tests/driver/multipleHomeUnits/multipleHomeUnitsModuleVisibility.stderr
- testsuite/tests/ghc-api/target-contents/TargetContents.stderr
- testsuite/tests/ghc-e/should_run/T2636.stderr
- testsuite/tests/module/mod1.stderr
- testsuite/tests/module/mod2.stderr
- + testsuite/tests/package/T22884.hs
- + testsuite/tests/package/T22884.stderr
- + testsuite/tests/package/T22884_interactive.script
- + testsuite/tests/package/T22884_interactive.stderr
- testsuite/tests/package/T4806.stderr
- + testsuite/tests/package/T4806_interactive.script
- + testsuite/tests/package/T4806_interactive.stderr
- testsuite/tests/package/T4806a.stderr
- testsuite/tests/package/all.T
- testsuite/tests/package/package01e.stderr
- testsuite/tests/package/package06e.stderr
- testsuite/tests/package/package07e.stderr
- testsuite/tests/package/package08e.stderr
- testsuite/tests/perf/compiler/parsing001.stderr
- testsuite/tests/plugins/T11244.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3635f32fe170a3b4a85d10ba56d576f9bea16df0...8d3c21ae621af3ac7bfbf79fc25d0044e8c8d6b5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3635f32fe170a3b4a85d10ba56d576f9bea16df0...8d3c21ae621af3ac7bfbf79fc25d0044e8c8d6b5
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/20230511/e1299f69/attachment.html>


More information about the ghc-commits mailing list