summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Errors
diff options
context:
space:
mode:
authorAlfredo Di Napoli <alfredo@well-typed.com>2021-07-06 10:08:46 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-07-09 08:46:44 -0400
commit1e8055175cbb63e06540610a0452906981584e6b (patch)
tree24ae0130c3e025a1986365e81f25d3133b2a609e /compiler/GHC/Tc/Errors
parent558724237b978ab2293a62ee48fe2b2f603a6791 (diff)
downloadhaskell-1e8055175cbb63e06540610a0452906981584e6b.tar.gz
Add TcRnSimplifierTooManyIterations to TcRnMessage
Diffstat (limited to 'compiler/GHC/Tc/Errors')
-rw-r--r--compiler/GHC/Tc/Errors/Ppr.hs9
-rw-r--r--compiler/GHC/Tc/Errors/Types.hs16
2 files changed, 25 insertions, 0 deletions
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs
index 9953971c24..fc69df5379 100644
--- a/compiler/GHC/Tc/Errors/Ppr.hs
+++ b/compiler/GHC/Tc/Errors/Ppr.hs
@@ -62,6 +62,11 @@ instance Diagnostic TcRnMessage where
-> mkSimpleDecorated $
vcat [text "Multiple warning declarations for" <+> quotes (ppr rdr_name),
text "also at " <+> ppr (getLocA d)]
+ TcRnSimplifierTooManyIterations limit wc
+ -> mkSimpleDecorated $
+ hang (text "solveWanteds: too many iterations"
+ <+> parens (text "limit =" <+> ppr limit))
+ 2 (text "Unsolved:" <+> ppr wc)
diagnosticReason = \case
TcRnUnknownMessage m
@@ -89,6 +94,8 @@ instance Diagnostic TcRnMessage where
-> WarningWithFlag Opt_WarnNameShadowing
TcRnDuplicateWarningDecls{}
-> ErrorWithoutFlag
+ TcRnSimplifierTooManyIterations{}
+ -> ErrorWithoutFlag
diagnosticHints = \case
TcRnUnknownMessage m
@@ -116,6 +123,8 @@ instance Diagnostic TcRnMessage where
-> noHints
TcRnDuplicateWarningDecls{}
-> noHints
+ TcRnSimplifierTooManyIterations{}
+ -> [SuggestIncreaseSimplifierIterations]
messageWithInfoDiagnosticMessage :: UnitState
-> ErrInfo
diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs
index f76ac52727..1e8a18a8a0 100644
--- a/compiler/GHC/Tc/Errors/Types.hs
+++ b/compiler/GHC/Tc/Errors/Types.hs
@@ -10,6 +10,7 @@ module GHC.Tc.Errors.Types (
) where
import GHC.Hs
+import GHC.Tc.Types.Constraint
import GHC.Types.Error
import GHC.Types.Name (Name, OccName)
import GHC.Types.Name.Reader
@@ -19,6 +20,7 @@ import GHC.Utils.Outputable
import Data.Typeable
import GHC.Core.Type (Type, Var)
import GHC.Unit.State (UnitState)
+import GHC.Types.Basic
{-
Note [Migrating TcM Messages]
@@ -196,6 +198,20 @@ data TcRnMessage where
-}
TcRnDuplicateWarningDecls :: !(LocatedN RdrName) -> !RdrName -> TcRnMessage
+ {-| TcRnDuplicateWarningDecls is an error that occurs whenever
+ the constraint solver in the simplifier hits the iterations' limit.
+
+ Examples(s):
+ None.
+
+ Test cases:
+ None.
+ -}
+ TcRnSimplifierTooManyIterations :: !IntWithInf
+ -- ^ The limit.
+ -> WantedConstraints
+ -> TcRnMessage
+
-- | Where a shadowed name comes from
data ShadowedNameProvenance