Fix #14369 by making injectivity warnings finer-grained
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 19 Oct 2017 14:21:28 +0000 (10:21 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Thu, 19 Oct 2017 14:21:28 +0000 (10:21 -0400)
commit8846a7fdcf2060dd37e66b4d1f89bd8fdfad4620
treecec0f07241fb1b9b1fcc225dfba26772802abb89
parent101a8c770b9d3abd57ff289bffea3d838cf25c80
Fix #14369 by making injectivity warnings finer-grained

Summary:
Previously, GHC would always raise the possibility that a
type family might not be injective in certain error messages, even if
that type family actually //was// injective. Fix this by actually
checking for a type family's lack of injectivity before emitting
such an error message.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14369

Differential Revision: https://phabricator.haskell.org/D4106
16 files changed:
compiler/typecheck/TcErrors.hs
testsuite/tests/indexed-types/should_fail/NoMatchErr.stderr
testsuite/tests/indexed-types/should_fail/T14369.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T14369.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T1897b.stderr
testsuite/tests/indexed-types/should_fail/T1900.stderr
testsuite/tests/indexed-types/should_fail/T2544.stderr
testsuite/tests/indexed-types/should_fail/T2664.stderr
testsuite/tests/indexed-types/should_fail/T4099.stderr
testsuite/tests/indexed-types/should_fail/T4179.stderr
testsuite/tests/indexed-types/should_fail/T9036.stderr
testsuite/tests/indexed-types/should_fail/T9171.stderr
testsuite/tests/indexed-types/should_fail/all.T
testsuite/tests/typecheck/should_fail/T5853.stderr
testsuite/tests/typecheck/should_fail/T8030.stderr
testsuite/tests/typecheck/should_fail/T8034.stderr