summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Errors
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Tc/Errors')
-rw-r--r--compiler/GHC/Tc/Errors/Ppr.hs14
-rw-r--r--compiler/GHC/Tc/Errors/Types.hs5
2 files changed, 11 insertions, 8 deletions
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs
index 8dae970dee..993b62a7ea 100644
--- a/compiler/GHC/Tc/Errors/Ppr.hs
+++ b/compiler/GHC/Tc/Errors/Ppr.hs
@@ -1,9 +1,10 @@
-{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} -- instance Diagnostic TcRnMessage
@@ -95,15 +96,16 @@ import Data.Ord ( comparing )
import Data.Bifunctor
import GHC.Types.Name.Env
-
instance Diagnostic TcRnMessage where
- diagnosticMessage = \case
- TcRnUnknownMessage m
- -> diagnosticMessage m
+ type DiagnosticOpts TcRnMessage = NoDiagnosticOpts
+ defaultDiagnosticOpts = NoDiagnosticOpts
+ diagnosticMessage opts = \case
+ TcRnUnknownMessage (UnknownDiagnostic @e m)
+ -> diagnosticMessage (defaultDiagnosticOpts @e) m
TcRnMessageWithInfo unit_state msg_with_info
-> case msg_with_info of
TcRnMessageDetailed err_info msg
- -> messageWithInfoDiagnosticMessage unit_state err_info (diagnosticMessage msg)
+ -> messageWithInfoDiagnosticMessage unit_state err_info (diagnosticMessage opts msg)
TcRnSolverReport msg _ _
-> mkSimpleDecorated $ pprSolverReportWithCtxt msg
TcRnRedundantConstraints redundants (info, show_info)
diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs
index 854ebd3bf6..d0d40366d9 100644
--- a/compiler/GHC/Tc/Errors/Types.hs
+++ b/compiler/GHC/Tc/Errors/Types.hs
@@ -182,12 +182,13 @@ data TcRnMessageDetailed
!TcRnMessage
deriving Generic
-mkTcRnUnknownMessage :: (Diagnostic a, Typeable a) => a -> TcRnMessage
+mkTcRnUnknownMessage :: (Diagnostic a, Typeable a, DiagnosticOpts a ~ NoDiagnosticOpts)
+ => a -> TcRnMessage
mkTcRnUnknownMessage diag = TcRnUnknownMessage (UnknownDiagnostic diag)
-- | An error which might arise during typechecking/renaming.
data TcRnMessage where
- {-| Simply wraps a generic 'Diagnostic' message @a@. It can be used by plugins
+ {-| Simply wraps an unknown 'Diagnostic' message @a@. It can be used by plugins
to provide custom diagnostic messages originated during typechecking/renaming.
-}
TcRnUnknownMessage :: UnknownDiagnostic -> TcRnMessage