Skip to content
Snippets Groups Projects
Commit 22d11fa8 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Marge Bot
Browse files

Track rewriter sets more accurately in constraint solving

The key change, which fixed #25440, is to call `recordRewriter` in
GHC.Tc.Solver.Rewrite.rewrite_exact_fam_app.  This missing call meant
that we were secretly rewriting a Wanted with a Wanted, but not really
noticing; and that led to a very bad error message, as you can see
in the ticket.

But of course that led me into rabbit hole of other refactoring around
the RewriteSet code:

* Improve Notes [Wanteds rewrite Wanteds]

* Zonk the RewriterSet in `zonkCtEvidence` rather than only in GHC.Tc.Errors.
  This is tidier anyway (e.g. de-clutters debug output), and helps with the
  next point.

* In GHC.Tc.Solver.Equality.inertsCanDischarge, don't replace a constraint
  with no rewriters with an equal constraint that has many. See
  See (CE4) in Note [Combining equalities]

* Move zonkRewriterSet and friends from GHC.Tc.Zonk.Type into
  GHC.Tc.Zonk.TcType, where they properly belong.

A handful of tests get better error messages.

For some reason T24984 gets 12% less compiler allocation -- good

Metric Decrease:
    T24984
parent ce616f49
No related branches found
No related tags found
Loading
Showing
with 379 additions and 262 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment