diff options
author | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2022-01-26 11:45:41 +0000 |
---|---|---|
committer | Simon Peyton Jones <simon.peytonjones@gmail.com> | 2022-01-26 18:09:39 +0000 |
commit | 011990f5f515e741b1643d6b5988c0ba77cc22ad (patch) | |
tree | 2adcec411185ac907060d4e23981a691251e8340 | |
parent | 781323a3076781b5db50bdbeb8f64394add43836 (diff) | |
download | haskell-011990f5f515e741b1643d6b5988c0ba77cc22ad.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] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |