summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-10-17 17:59:57 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-19 10:47:52 -0400
commit607ce263fd8304d02c24e997abc0d17ead1cb19b (patch)
tree84626cb0f75eb8a5f8c82c03de1b6e99e9dfa52e
parent488d36311709f958f6c759952fc8379b231e69ca (diff)
downloadhaskell-607ce263fd8304d02c24e997abc0d17ead1cb19b.tar.gz
Rename unsafeOverlap_matches -> unsafeOverlap_match in UnsafeOverlap
-rw-r--r--compiler/GHC/Tc/Errors.hs4
-rw-r--r--compiler/GHC/Tc/Errors/Ppr.hs4
-rw-r--r--compiler/GHC/Tc/Errors/Types.hs2
3 files changed, 4 insertions, 6 deletions
diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs
index 3a3e474b80..021d163d84 100644
--- a/compiler/GHC/Tc/Errors.hs
+++ b/compiler/GHC/Tc/Errors.hs
@@ -2204,8 +2204,6 @@ mkDictErr ctxt orig_items
-- and the result of evaluating ...".
mk_dict_err :: HasCallStack => SolverReportErrCtxt -> (ErrorItem, ClsInstLookupResult)
-> TcM TcSolverReportMsg
--- Report an overlap error if this class constraint results
--- from an overlap (returning Left clas), otherwise return (Right pred)
mk_dict_err ctxt (item, (matches, unifiers, unsafe_overlapped)) = case (NE.nonEmpty matches, NE.nonEmpty unsafe_overlapped) of
(Nothing, _) -> do -- No matches but perhaps several unifiers
{ (_, rel_binds, item) <- relevantBindings True ctxt item
@@ -2219,7 +2217,7 @@ mk_dict_err ctxt (item, (matches, unifiers, unsafe_overlapped)) = case (NE.nonEm
(Just (match :| []), Just unsafe_overlappedNE) -> return $
UnsafeOverlap item (fst match) (NE.map fst unsafe_overlappedNE)
- (Just (_ :| rest), Just{}) -> pprPanic "should be empty" (ppr rest)
+ (Just matches@(_ :| _), Just overlaps) -> pprPanic "mk_dict_err: multiple matches with overlap" $ vcat [ text "matches:" <+> ppr matches, text "overlaps:" <+> ppr overlaps ]
where
orig = errorItemOrigin item
pred = errorItemPred item
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs
index ac01c9e8e7..0c152b27b7 100644
--- a/compiler/GHC/Tc/Errors/Ppr.hs
+++ b/compiler/GHC/Tc/Errors/Ppr.hs
@@ -2429,11 +2429,11 @@ pprTcSolverReportMsg (CEC {cec_encl = implics}) (OverlappingInstances item match
Just (clas', tys') -> clas' == clas
&& isJust (tcMatchTys tys tys')
Nothing -> False
-pprTcSolverReportMsg _ (UnsafeOverlap item matches unsafe_overlapped) =
+pprTcSolverReportMsg _ (UnsafeOverlap item match unsafe_overlapped) =
vcat [ addArising ct_loc (text "Unsafe overlapping instances for"
<+> pprType (mkClassPred clas tys))
, sep [text "The matching instance is:",
- nest 2 (pprInstance matches)]
+ nest 2 (pprInstance match)]
, vcat [ text "It is compiled in a Safe module and as such can only"
, text "overlap instances from the same module, however it"
, text "overlaps the following instances from different" <+>
diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs
index bd9851f475..fdf7c3d665 100644
--- a/compiler/GHC/Tc/Errors/Types.hs
+++ b/compiler/GHC/Tc/Errors/Types.hs
@@ -3038,7 +3038,7 @@ data TcSolverReportMsg
-- Test cases: SH_Overlap{1,2,5,6,7,11}.
| UnsafeOverlap
{ unsafeOverlap_item :: ErrorItem
- , unsafeOverlap_matches :: ClsInst
+ , unsafeOverlap_match :: ClsInst
, unsafeOverlapped :: NE.NonEmpty ClsInst }
deriving Generic