Suppress redundant givens during error reporting
ClosedPublic

Authored by RyanGlScott on Jul 23 2018, 10:50 AM.

Details

Summary

When GHC reports that it cannot solve a constraint in error
messages, it often reports what given constraints it has in scope.
Unfortunately, sometimes redundant constraints (like * ~ *, from
Trac #15361) can sneak in. The fix is simple: blast away these redundant
constraints using mkMinimalBySCs.

Test Plan

make test TEST=T15361

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
RyanGlScott created this revision.Jul 23 2018, 10:50 AM
  • Add a Note

Rebase on top of master

Thanks. a few wording suggestions

compiler/typecheck/TcErrors.hs
1848

Please point explicitly to where this is done -- it's quite hard to find. It's this code

givens  = [ given | given <- getUserGivens ctxt, not (ic_no_eqs given)]
          -- Keep only UserGivens that have some equalities

in misMachOrCND. And make that code point to this Note. Also this implication really *does* apparently bind some equalities; but ic_no_eqs refines it to find whether it *really* does so.

1861

Again, that's because ic_no_eqs field applies to whole implication; we don't do this on a constraint-by-constraint basis

RyanGlScott marked 2 inline comments as done.

Thans!

compiler/typecheck/TcErrors.hs
1849
This is done by filtering the `givens` selected in `misMatchOrCND`.

And could you please make that line in misMatchOrCND point to this note?

  • Refine
compiler/typecheck/TcErrors.hs
1849

Is this how you intended it to be worded?

And could you please make that line in misMatchOrCND point to this note?

...I did this already? See line 1813.

Great thans!

This revision was not accepted when it landed; it landed in state Needs Review.Aug 12 2018, 11:49 AM
This revision was automatically updated to reflect the committed changes.