Make dischargeFmv handle Deriveds
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 21 May 2018 09:38:03 +0000 (10:38 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 21 May 2018 12:04:09 +0000 (13:04 +0100)
commit57858fc8b519078ae89a4859ce7588adb39f6e96
tree49bda8417bb27285cd7e676221f0615740d557af
parentb7e80ae005d0072eda79135c371a794dc48f70e1
Make dischargeFmv handle Deriveds

A Derived CFunEqCan does not "own" its FlatMetaTv (fmv), and should not
update it.  But one caller (canCFunEqCan) was failing to satisfy the
precondition to dischargeFmv, which led to a crash (Trac #15170).

I fixed this by making dischargeFmv handle Deriveds (to avoid forcing
each caller to do so separately).

NB: this does not completely fix the original #15170 bug, but I'll
explain that on the ticket.  The test case for this patch is actually
the program in comment:1.
compiler/typecheck/TcFlatten.hs
compiler/typecheck/TcInteract.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSMonad.hs
testsuite/tests/polykinds/T15170.hs [new file with mode: 0644]
testsuite/tests/polykinds/all.T