diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs index 8379202af0a26e5ad496e898422bd119bf9509c0..ce325b285dbb75264c4bcfb988a24b9d5518f0ac 100644 --- a/compiler/GHC/Tc/Errors.hs +++ b/compiler/GHC/Tc/Errors.hs @@ -470,6 +470,8 @@ mkErrorItem ct flav = ctFlavour ct ; (suppress, m_evdest) <- case ctEvidence ct of + -- For this `suppress` stuff + -- see Note [Wanteds rewrite Wanteds] in GHC.Tc.Types.Constraint CtGiven {} -> return (False, Nothing) CtWanted { ctev_rewriters = rewriters, ctev_dest = dest } -> do { rewriters' <- zonkRewriterSet rewriters diff --git a/compiler/GHC/Tc/Types/Constraint.hs b/compiler/GHC/Tc/Types/Constraint.hs index 6816f80428d5839b2a16c9c8d6b19ad498edf023..26e0d694fb52a24c1d94150bdbe999a0337d2d47 100644 --- a/compiler/GHC/Tc/Types/Constraint.hs +++ b/compiler/GHC/Tc/Types/Constraint.hs @@ -1459,13 +1459,13 @@ can't be solved. But not quite all such constraints; see wrinkles. it looks only for IrredCt; all insoluble constraints oare put into CIrredCan -(IW2) We only treat it as insoluble if it has an empty rewriter set. - Otherwise #25325 happens: a Wanted constraint A that is /not/ insoluble - rewrites some other Wanted constraint B, so B has A in its rewriter - set. Now B looks insoluble. The danger is that we'll suppress reporting - B becuase of its empty rewriter set; and suppress reporting A because - there is an insoluble B lying around. (This suppression happens in - GHC.Tc.Errors.) Solution: don't treat B as insoluble. +(IW2) We only treat it as insoluble if it has an empty rewriter set. (See Note + [Wanteds rewrite Wanteds].) Otherwise #25325 happens: a Wanted constraint A + that is /not/ insoluble rewrites some other Wanted constraint B, so B has A + in its rewriter set. Now B looks insoluble. The danger is that we'll + suppress reporting B becuase of its empty rewriter set; and suppress + reporting A because there is an insoluble B lying around. (This suppression + happens in GHC.Tc.Errors.mkErrorItem.) Solution: don't treat B as insoluble. (IW3) If the Wanted arises from a Given (how can that happen?), don't treat it as a Wanted insoluble (obviously).