Clean up the conflicting data family instances error message
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 24 May 2018 14:33:51 +0000 (10:33 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Thu, 24 May 2018 14:33:51 +0000 (10:33 -0400)
commit979f085c4f87a93f48d6b567076d3c556d490fa8
treeb1bc4eb705d16531780111bb5c828d370a5bcd65
parent1879d9d2c95239f6705af0cbac5fed7d9b220f28
Clean up the conflicting data family instances error message

Summary:
The way we were pretty-printing conflicting data family
instances in an error message was far from ideal:

1. If a data type had no constructors, it would print an equals sign
   with nothing to the right of it.
2. It would try to print GADTs using Haskell98 syntax.
3. It eta-reduced away some type variables from the LHS.

This patch addresses these three issues:

1. We no longer print constructors at all in this error message.
   There's really no reason to do so in the first place, since
   duplicate data family instances always conflict, regardless of
   their constructors.
2. Since we no longer print constructors, we no longer have to
   worry about whether we're using GADT or Haskell98 syntax.
3. I've put in a fix to ensure that type variables are no longer
   eta-reduced away from the LHS.

Test Plan: make test TEST=T14179

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14179

Differential Revision: https://phabricator.haskell.org/D4711
16 files changed:
compiler/types/Coercion.hs
testsuite/tests/indexed-types/should_fail/Over.stderr
testsuite/tests/indexed-types/should_fail/OverDirectThisMod.stderr
testsuite/tests/indexed-types/should_fail/OverIndirectThisMod.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail11a.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail11b.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail11c.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail11d.stderr
testsuite/tests/indexed-types/should_fail/SimpleFail2b.stderr
testsuite/tests/indexed-types/should_fail/T14179.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T14179.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T2334A.stderr
testsuite/tests/indexed-types/should_fail/T9371.stderr
testsuite/tests/indexed-types/should_fail/all.T
testsuite/tests/partial-sigs/should_compile/DataFamilyInstanceLHS.stderr
testsuite/tests/partial-sigs/should_compile/NamedWildcardInDataFamilyInstanceLHS.stderr