From aac87bd388547e28aca1c19e7436ff5fa9245f04 Mon Sep 17 00:00:00 2001 From: Alfredo Di Napoli Date: Tue, 20 Apr 2021 11:03:01 +0200 Subject: Extensible Hints for diagnostic messages This commit extends the GHC diagnostic hierarchy with a `GhcHint` type, modelling helpful suggestions emitted by GHC which can be used to deal with a particular warning or error. As a direct consequence of this, the `Diagnostic` typeclass has been extended with a `diagnosticHints` method, which returns a `[GhcHint]`. This means that now we can clearly separate out the printing of the diagnostic message with the suggested fixes. This is done by extending the `printMessages` function in `GHC.Driver.Errors`. On top of that, the old `PsHint` type has been superseded by the new `GhcHint` type, which de-duplicates some hints in favour of a general `SuggestExtension` constructor that takes a `GHC.LanguageExtensions.Extension`. --- compiler/GHC/Driver/Pipeline.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/GHC/Driver/Pipeline.hs') diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs index 9a5fa6819e..2ad69bc4a2 100644 --- a/compiler/GHC/Driver/Pipeline.hs +++ b/compiler/GHC/Driver/Pipeline.hs @@ -152,7 +152,7 @@ preprocess hsc_env input_fn mb_input_buf mb_phase = handler (ProgramError msg) = return $ Left $ singleMessage $ mkPlainErrorMsgEnvelope srcspan $ - DriverUnknownMessage $ mkPlainError $ text msg + DriverUnknownMessage $ mkPlainError noHints $ text msg handler ex = throwGhcExceptionIO ex to_driver_messages :: Messages GhcMessage -> Messages DriverMessage -- cgit v1.2.1