summaryrefslogtreecommitdiff
path: root/compiler/GHC/Linker
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-09-12 13:52:24 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-13 10:27:52 -0400
commit65a0bd69ac1fb59047cd4c8554a8fc756c7b3476 (patch)
treebc5d257c7d987097d45a9b5b61d8e1ed3cf883d3 /compiler/GHC/Linker
parent3a815f30bcba5672085e823aeef90863253b0b1a (diff)
downloadhaskell-65a0bd69ac1fb59047cd4c8554a8fc756c7b3476.tar.gz
Add diagnostic codes
This MR adds diagnostic codes, assigning unique numeric codes to error and warnings, e.g. error: [GHC-53633] Pattern match is redundant This is achieved as follows: - a type family GhcDiagnosticCode that gives the diagnostic code for each diagnostic constructor, - a type family ConRecursInto that specifies whether to recur into an argument of the constructor to obtain a more fine-grained code (e.g. different error codes for different 'deriving' errors), - generics machinery to generate the value-level function assigning each diagnostic its error code; see Note [Diagnostic codes using generics] in GHC.Types.Error.Codes. The upshot is that, to add a new diagnostic code, contributors only need to modify the two type families mentioned above. All logic relating to diagnostic codes is thus contained to the GHC.Types.Error.Codes module, with no code duplication. This MR also refactors error message datatypes a bit, ensuring we can derive Generic for them, and cleans up the logic around constraint solver reports by splitting up 'TcSolverReportInfo' into separate datatypes (see #20772). Fixes #21684
Diffstat (limited to 'compiler/GHC/Linker')
-rw-r--r--compiler/GHC/Linker/Loader.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Linker/Loader.hs b/compiler/GHC/Linker/Loader.hs
index 6c2829c432..286c50416c 100644
--- a/compiler/GHC/Linker/Loader.hs
+++ b/compiler/GHC/Linker/Loader.hs
@@ -1505,7 +1505,7 @@ load_dyn interp hsc_env crash_early dll = do
else
when (diag_wopt Opt_WarnMissedExtraSharedLib diag_opts)
$ logMsg logger
- (mkMCDiagnostic diag_opts $ WarningWithFlag Opt_WarnMissedExtraSharedLib)
+ (mkMCDiagnostic diag_opts (WarningWithFlag Opt_WarnMissedExtraSharedLib) Nothing)
noSrcSpan $ withPprStyle defaultUserStyle (note err)
where
diag_opts = initDiagOpts (hsc_dflags hsc_env)
@@ -1693,7 +1693,7 @@ locateLib interp hsc_env is_hs lib_dirs gcc_dirs lib0
, not loading_dynamic_hs_libs
, interpreterProfiled interp
= do
- let diag = mkMCDiagnostic diag_opts WarningWithoutFlag
+ let diag = mkMCDiagnostic diag_opts WarningWithoutFlag Nothing
logMsg logger diag noSrcSpan $ withPprStyle defaultErrStyle $
text "Interpreter failed to load profiled static library" <+> text lib <> char '.' $$
text " \tTrying dynamic library instead. If this fails try to rebuild" <+>