Preserve ShadowInfo when rewriting evidence
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 3 Jun 2019 13:46:39 +0000 (14:46 +0100)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Fri, 7 Jun 2019 14:24:00 +0000 (10:24 -0400)
commitda26ffe795f1861783c1b031ed93f9fa59550f85
treea19114acaf010962e81bdcd2e49f53a781ce33aa
parent387050d0e26a9e6466b31c9d8e4e4f6273c64c9e
Preserve ShadowInfo when rewriting evidence

When the canonicaliser rewrites evidence of a Wanted, it
should preserve the ShadowInfo (ctev_nosh) field.  That is,
a WDerive should rewrite to WDerive, and WOnly to WOnly.

Previously we were unconditionally making a WDeriv, thereby
rewriting WOnly to WDeriv.  This bit Nick Frisby (issue #16735)
in the context of his plugin, but we don't have a compact test
case.

The fix is simple, but does involve a bit more plumbing,
to pass the old ShadowInfo around, to use when building
the new Wanted.
compiler/typecheck/TcCanonical.hs
compiler/typecheck/TcSMonad.hs
testsuite/tests/polykinds/T14172.stderr