Skip to content

Fix a serious bug in roughMatchTcs

Simon Peyton Jones requested to merge wip/T19336 into master

The roughMatchTcs function enables a quick definitely-no-match test in lookupInstEnv. Unfortunately, it didn't account for type families. This didn't matter when type families were flattened away, but now they aren't flattened it matters a lot.

The fix is very easy. See INVARIANT in GHC.Core.InstEnv Note [ClsInst laziness and the rough-match fields]

Fixes #19336 (closed)

 compiler/GHC/Core/InstEnv.hs                               | 19 +++++++++++++------
 compiler/GHC/Core/Unify.hs                                 |  7 +++++--
 testsuite/tests/indexed-types/should_compile/T19336.hs     | 43 +++++++++++++++++++++++++++++++++++++++++++
 testsuite/tests/indexed-types/should_compile/T19336.stderr |  4 ++++
 testsuite/tests/indexed-types/should_compile/all.T         |  1 +
 5 files changed, 66 insertions(+), 8 deletions(-)

Merge request reports