Fix #16008 with a pinch of addConsistencyConstraints

Authored by RyanGlScott on Dec 10 2018, 3:04 PM.



Trac #16008 happened because we forgot to typecheck nullary
associated type family instances in a way that's consistent with the
type variables bound by the parent class. Oops. Easily fixed with a
use of checkConsistencyConstraints.

Test Plan

make test TEST=T16008

Diff Detail

rGHC Glasgow Haskell Compiler
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
RyanGlScott created this revision.Dec 10 2018, 3:04 PM
goldfire accepted this revision.Dec 10 2018, 3:21 PM


This revision is now accepted and ready to land.Dec 10 2018, 3:21 PM
simonpj requested changes to this revision.Dec 10 2018, 4:44 PM

Thanks for doing this


Good catch. But we can do better!

  • Remove addConsistencyConstraints from tcFamTyPats; and don't pass mb_clsinfo to it.
  • Instead put the call to addConsistencyConstraints
    • After the call to tcFamTyPats in tcDataFamHeader
    • After the call to tc_lhs in tcTyFamInstEqnGuts

Result is that the interface to tcFamTyPats becomes simpler. There are still two calls to addConsistencyConstraints but they are where we expect: one for type-family instances and one for data-family instances.

This revision now requires changes to proceed.Dec 10 2018, 4:44 PM
RyanGlScott marked an inline comment as done.
This revision was not accepted when it landed; it landed in state Needs Review.Dec 11 2018, 5:26 AM
This revision was automatically updated to reflect the committed changes.