diff options
author | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2022-01-26 11:45:41 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-01-27 18:37:17 -0500 |
commit | 7f8ce19eb7400ae93661b173b5fc8ee6396da632 (patch) | |
tree | d8cbf121946dcefda8ed55846ff4ac619f45e449 | |
parent | ee21e2de475d9c8a5e1fe334e2d4ef7cd49d8726 (diff) | |
download | haskell-7f8ce19eb7400ae93661b173b5fc8ee6396da632.tar.gz |
Fix getHasGivenEqs
The second component is supposed to be "insoluble equalities arising
from givens". But we were getting wanteds too; and that led to an
outright duplication of constraints. It's not harmful, but it's not
right either.
I came across this when debugging something else. Easily fixed.
-rw-r--r-- | compiler/GHC/Tc/Solver/Monad.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Solver/Monad.hs b/compiler/GHC/Tc/Solver/Monad.hs index 7efc6c9ab9..a53074fab1 100644 --- a/compiler/GHC/Tc/Solver/Monad.hs +++ b/compiler/GHC/Tc/Solver/Monad.hs @@ -948,10 +948,10 @@ getHasGivenEqs tclvl , inert_given_eqs = given_eqs , inert_given_eq_lvl = ge_lvl }) <- getInertCans - ; let insols = filterBag insolubleEqCt irreds + ; let given_insols = filterBag insoluble_given_equality irreds -- Specifically includes ones that originated in some -- outer context but were refined to an insoluble by - -- a local equality; so do /not/ add ct_given_here. + -- a local equality; so no level-check needed -- See Note [HasGivenEqs] in GHC.Tc.Types.Constraint, and -- Note [Tracking Given equalities] in GHC.Tc.Solver.InertSet @@ -964,8 +964,11 @@ getHasGivenEqs tclvl , text "ge_lvl:" <+> ppr ge_lvl , text "ambient level:" <+> ppr tclvl , text "Inerts:" <+> ppr inerts - , text "Insols:" <+> ppr insols] - ; return (has_ge, insols) } + , text "Insols:" <+> ppr given_insols] + ; return (has_ge, given_insols) } + where + insoluble_given_equality ct + = insolubleEqCt ct && isGivenCt ct {- Note [Unsolved Derived equalities] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |