summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Solver.hs
diff options
context:
space:
mode:
authorAlfredo Di Napoli <alfredo@well-typed.com>2021-08-23 16:09:03 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-07 12:24:12 -0400
commit7fa8c32c107ee28676bd17a7f0fc797a87502779 (patch)
treeecbfa639f6ddc8b2f667eedf2911eb4d754642a1 /compiler/GHC/Tc/Solver.hs
parent2735f5a6103eb99e44776da0f5b9d35a18279cbc (diff)
downloadhaskell-7fa8c32c107ee28676bd17a7f0fc797a87502779.tar.gz
Add and use new constructors to TcRnMessage
This commit adds the following constructors to the TcRnMessage type and uses them to replace sdoc-based diagnostics in some parts of GHC (e.g. TcRnUnknownMessage). It includes: * Add TcRnMonomorphicBindings diagnostic * Convert TcRnUnknownMessage in Tc.Solver.Interact * Add and use the TcRnOrphanInstance constructor to TcRnMessage * Add TcRnFunDepConflict and TcRnDupInstanceDecls constructors to TcRnMessage * Add and use TcRnConflictingFamInstDecls constructor to TcRnMessage * Get rid of TcRnUnknownMessage from GHC.Tc.Instance.Family
Diffstat (limited to 'compiler/GHC/Tc/Solver.hs')
-rw-r--r--compiler/GHC/Tc/Solver.hs14
1 files changed, 2 insertions, 12 deletions
diff --git a/compiler/GHC/Tc/Solver.hs b/compiler/GHC/Tc/Solver.hs
index e2ea2f59de..7836c4a1b4 100644
--- a/compiler/GHC/Tc/Solver.hs
+++ b/compiler/GHC/Tc/Solver.hs
@@ -1410,8 +1410,7 @@ decideMonoTyVars infer_mode name_taus psigs candidates
-- Warn about the monomorphism restriction
; when (case infer_mode of { ApplyMR -> True; _ -> False}) $ do
- let dia = TcRnUnknownMessage $
- mkPlainDiagnostic (WarningWithFlag Opt_WarnMonomorphism) noHints mr_msg
+ let dia = TcRnMonomorphicBindings (map fst name_taus)
diagnosticTc (constrained_tvs `intersectsVarSet` tyCoVarsOfTypes taus) dia
; traceTc "decideMonoTyVars" $ vcat
@@ -1441,15 +1440,6 @@ decideMonoTyVars infer_mode name_taus psigs candidates
| otherwise
= False
- pp_bndrs = pprWithCommas (quotes . ppr . fst) name_taus
- mr_msg =
- hang (sep [ text "The Monomorphism Restriction applies to the binding"
- <> plural name_taus
- , text "for" <+> pp_bndrs ])
- 2 (hsep [ text "Consider giving"
- , text (if isSingleton name_taus then "it" else "them")
- , text "a type signature"])
-
-------------------
defaultTyVarsAndSimplify :: TcLevel
-> TyCoVarSet
@@ -1860,7 +1850,7 @@ maybe_simplify_again n limit unif_happened wc@(WC { wc_simple = simples })
-- Typically if we blow the limit we are going to report some other error
-- (an unsolved constraint), and we don't want that error to suppress
-- the iteration limit warning!
- addErrTcS $ TcRnSimplifierTooManyIterations limit wc
+ addErrTcS $ TcRnSimplifierTooManyIterations simples limit wc
; return wc }
| unif_happened