summaryrefslogtreecommitdiff
path: root/compiler/GHC/Parser/Header.hs
diff options
context:
space:
mode:
authorAlfredo Di Napoli <alfredo@well-typed.com>2021-07-27 09:45:27 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-28 13:20:52 -0400
commit4a2ef3dd38adf613f425bb1ef8a8614bea558ff0 (patch)
tree3e7173fa8426e4bd70997ae160966b3e362f2572 /compiler/GHC/Parser/Header.hs
parent3382b3d6f9a818d0afe62112dd368ae04778d16e (diff)
downloadhaskell-4a2ef3dd38adf613f425bb1ef8a8614bea558ff0.tar.gz
Port more DriverUnknownMessage into richer DriverMessage constructors
In order: * Introduce the `PsErrUnknownOptionsPragma` diagnostic message This commit changes the diagnostic emitted inside `GHC.Parser.Header.checkProcessArgsResult` from an (erroneous) and unstructured `DriverUnknownMessage` to a `PsErrUnknownOPtionsPragma`, i.e. a new data constructor of a `PsHeaderMessage`. * Add the `DriverUserDefinedRuleIgnored` diagnostic message * Add `DriverUserDefinedRuleIgnored` data constructor This commit adds (and use) a new data constructor to the `DriverMessage` type, replacing a `DriverUnknownMessage` with it. * Add and use `DriverCannotLoadInterfaceFile` constructor This commit introduces the DriverCannotLoadInterfaceFile constructor for the `DriverMessage` type and it uses it to replace and occurrence of `DriverUnknownMessage`. * Add and use the `DriverInferredSafeImport` constructor This commit adds a new `DriverInferredSafeImport` constructor to the `DriverMessage` type, and uses it in `GHC.Driver.Main` to replace one occurrence of `DriverUnknownMessage`. * Add and use `DriverCannotImportUnsafeModule` constructor This commit adds the `DriverCannotImportUnsafeModule` constructor to the `DriverMessage` type, and later using it to replace one usage of `DriverUnknownMessage` in the `GHC.Driver.Main` module. * Add and use `DriverMissingSafeHaskellMode` constructor * Add and use `DriverPackageNotTrusted` constructor * Introduce and use `DriverInferredSafeModule` constructor * Add and use `DriverMarkedTrustworthyButInferredSafe` constructor * Add and use `DriverCannotImportFromUntrustedPackage`
Diffstat (limited to 'compiler/GHC/Parser/Header.hs')
-rw-r--r--compiler/GHC/Parser/Header.hs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/GHC/Parser/Header.hs b/compiler/GHC/Parser/Header.hs
index 68468d89eb..1199d64957 100644
--- a/compiler/GHC/Parser/Header.hs
+++ b/compiler/GHC/Parser/Header.hs
@@ -39,7 +39,6 @@ import GHC.Types.SourceError
import GHC.Types.SourceText
import GHC.Utils.Misc
-import GHC.Utils.Outputable as Outputable
import GHC.Utils.Panic
import GHC.Utils.Monad
import GHC.Utils.Error
@@ -422,9 +421,7 @@ checkProcessArgsResult flags
liftIO $ throwErrors $ foldMap (singleMessage . mkMsg) flags
where mkMsg (L loc flag)
= mkPlainErrorMsgEnvelope loc $
- GhcDriverMessage $ DriverUnknownMessage $ mkPlainError noHints $
- text "unknown flag in {-# OPTIONS_GHC #-} pragma:" <+>
- text flag
+ GhcPsMessage $ PsHeaderMessage $ PsErrUnknownOptionsPragma flag
-----------------------------------------------------------------------------