diff options
| author | Alfredo Di Napoli <alfredo@well-typed.com> | 2021-04-20 11:03:01 +0200 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-20 18:08:37 -0400 |
| commit | aac87bd388547e28aca1c19e7436ff5fa9245f04 (patch) | |
| tree | 3c03ec7ad5336d45c4108483df0a2f5bce70de1f /compiler/GHC/Parser/Header.hs | |
| parent | 7c066734705048edb5b5b0afc30acea0805ec18d (diff) | |
| download | haskell-aac87bd388547e28aca1c19e7436ff5fa9245f04.tar.gz | |
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`.
Diffstat (limited to 'compiler/GHC/Parser/Header.hs')
| -rw-r--r-- | compiler/GHC/Parser/Header.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs index bb0aee09be..7a60830d34 100644 --- a/compiler/GHC/Parser/Header.hs +++ b/compiler/GHC/Parser/Header.hs @@ -425,7 +425,7 @@ checkProcessArgsResult flags liftIO $ throwErrors $ foldMap (singleMessage . mkMsg) flags where mkMsg (L loc flag) = mkPlainErrorMsgEnvelope loc $ - GhcDriverMessage $ DriverUnknownMessage $ mkPlainError $ + GhcDriverMessage $ DriverUnknownMessage $ mkPlainError noHints $ text "unknown flag in {-# OPTIONS_GHC #-} pragma:" <+> text flag @@ -469,5 +469,5 @@ optionsParseError str loc = throwErr :: SrcSpan -> SDoc -> a -- #15053 throwErr loc doc = - let msg = mkPlainErrorMsgEnvelope loc $ GhcPsMessage $ PsUnknownMessage $ mkPlainError doc + let msg = mkPlainErrorMsgEnvelope loc $ GhcPsMessage $ PsUnknownMessage $ mkPlainError noHints doc in throw $ mkSrcErr $ singleMessage msg |
