Fix a nasty superclass expansion bug
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 8 Feb 2016 14:41:08 +0000 (14:41 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 8 Feb 2016 15:08:54 +0000 (15:08 +0000)
commit43e02d1270701a1043be67f078cf2b1a85047feb
tree26aba405d5ad13a5c9190f960483341e467d530a
parent6252b70a2fc61ff90c7abc93d2e9f05cf60ab47e
Fix a nasty superclass expansion bug

This patch fixes Trac #11523.

* The basic problem was that TcRnTypes.superClassesMightHelp was
  returning True of a Derived constraint, and that led to us
  expanding Given superclasses, which produced the same Derived
  constraint again, and so on infinitely.  We really want to do
  this only if there are unsolve /Wanted/ contraints!

* On the way I made TcSMonad.getUnsolvedInerts a bit more
  discriminating about which Derived equalities it returns;
  see Note [Unsolved Derived equalities] in TcSMonad

* Lots of new comments in TcSMonad.
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSMonad.hs
testsuite/tests/polykinds/T11523.hs [new file with mode: 0644]
testsuite/tests/polykinds/all.T
testsuite/tests/typecheck/should_fail/T5853.stderr