summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Module.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-03-25 16:27:53 +0000
committerFendor <power.walross@gmail.com>2021-04-10 10:35:38 +0200
commitb014f902c75b9c071b25815b2876adebb2cb5a44 (patch)
treebd7291660e69662d64226b944ec69ff542e47e30 /compiler/GHC/Tc/Module.hs
parenta951e06921f05df1601d9c3a39efcede27f3330c (diff)
downloadhaskell-wip/T19296.tar.gz
More accurate SrcSpan when reporting redundant constraintswip/T19296
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/Module.hs')
-rw-r--r--compiler/GHC/Tc/Module.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index e906dd267f..777086343b 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -1781,7 +1781,7 @@ checkMainType tcg_env
[main_gre] ->
do { let main_name = greMangledName main_gre
- ctxt = FunSigCtxt main_name False
+ ctxt = FunSigCtxt main_name NoRRC
; main_id <- tcLookupId main_name
; (io_ty,_) <- getIOType
; (_, lie) <- captureTopConstraints $
@@ -1914,7 +1914,7 @@ setMainCtxt main_name io_ty thing_inside
checkConstraints skol_info [] [] $ -- Builds an implication if necessary
thing_inside -- e.g. with -fdefer-type-errors
where
- skol_info = SigSkol (FunSigCtxt main_name False) io_ty []
+ skol_info = SigSkol (FunSigCtxt main_name NoRRC) io_ty []
main_ctxt = text "When checking the type of the"
<+> ppMainFn (nameOccName main_name)