Suppress redundant givens during error reporting
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 12 Aug 2018 15:27:27 +0000 (17:27 +0200)
committerBen Gamari <ben@smart-cactus.org>
Thu, 23 Aug 2018 22:50:23 +0000 (18:50 -0400)
commit89ad5fed345d54ed73ecb3057346f3ef81864c8c
tree2dc7e28bb3a6c3713008a3e9cba31430be96f40e
parentc69c9d399746966f5d4ffbf73f49cd768a097dbd
Suppress redundant givens during error reporting

Summary:
When GHC reports that it cannot solve a constraint in error
messages, it often reports what given constraints it has in scope.
Unfortunately, sometimes redundant constraints (like `* ~ *`,
from  #15361) can sneak in. The fix is simple: blast away these
redundant constraints using `mkMinimalBySCs`.

Test Plan: make test TEST=T15361

Reviewers: simonpj, bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15361

Differential Revision: https://phabricator.haskell.org/D5002

(cherry picked from commit c552feea127d8ed8cbf4994a157c4bbe254b96c3)
compiler/typecheck/TcErrors.hs
testsuite/tests/typecheck/should_fail/T15361.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T15361.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T5853.stderr
testsuite/tests/typecheck/should_fail/all.T