summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/TyCl/Class.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-03-25 16:27:53 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-12 13:50:49 -0400
commit792d9289434cb7418a559cd4157ee3bfaef54c99 (patch)
tree252759700c5d633f5ac558723117a70add531d8c /compiler/GHC/Tc/TyCl/Class.hs
parent6974c9e478120f6c4eeb53ebfa935c30cafcdf8e (diff)
downloadhaskell-792d9289434cb7418a559cd4157ee3bfaef54c99.tar.gz
More accurate SrcSpan when reporting redundant constraints
We want an accurate SrcSpan for redundant constraints: • Redundant constraint: Eq a • In the type signature for: f :: forall a. Eq a => a -> () | 5 | f :: Eq a => a -> () | ^^^^ This patch adds some plumbing to achieve this * New data type GHC.Tc.Types.Origin.ReportRedundantConstraints (RRC) * This RRC value is kept inside - FunSigCtxt - ExprSigCtxt * Then, when reporting the error in GHC.Tc.Errors, use this SrcSpan to control the error message: GHC.Tc.Errors.warnRedundantConstraints Quite a lot of files are touched in a boring way.
Diffstat (limited to 'compiler/GHC/Tc/TyCl/Class.hs')
-rw-r--r--compiler/GHC/Tc/TyCl/Class.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/TyCl/Class.hs b/compiler/GHC/Tc/TyCl/Class.hs
index 491e657811..72de8f0652 100644
--- a/compiler/GHC/Tc/TyCl/Class.hs
+++ b/compiler/GHC/Tc/TyCl/Class.hs
@@ -282,8 +282,8 @@ tcDefMeth clas tyvars this_dict binds_in hs_sig_fn prag_fn
-- NB: the binding is always a FunBind
warn_redundant = case dm_spec of
- GenericDM {} -> True
- VanillaDM -> False
+ GenericDM {} -> lhsSigTypeContextSpan hs_ty
+ VanillaDM -> NoRRC
-- For GenericDM, warn if the user specifies a signature
-- with redundant constraints; but not for VanillaDM, where
-- the default method may well be 'error' or something