Fix #13972 by producing tidier errors
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 17 Aug 2017 14:06:32 +0000 (10:06 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Thu, 17 Aug 2017 14:06:33 +0000 (10:06 -0400)
commit38260a9e9f8c38edd25f4b4c06e0ea5d88fc6bf2
tree3526ad1bfaac249022896747e07ca4d67101cb22
parentb0ed07fafbe96c3eee6c7f41ef937973bedbf1dc
Fix #13972 by producing tidier errors

Summary:
Previously, one could experience an error message like this:

```
Expected: T (a -> Either a b)
  Actual: T (a -> Either a b)
```

This makes the error message an iota clearer by tidying it first, which will
instead produce:

```
Expected: T (a1 -> Either a1 b1)
  Actual: T (a -> Either a b)
```

Which steers users towards the understanding that the two sets of tyvars are
actually different.

Test Plan: make test TEST=T13972

Reviewers: simonpj, austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: goldfire, rwbarton, thomie

GHC Trac Issues: #13972

Differential Revision: https://phabricator.haskell.org/D3820
compiler/typecheck/TcValidity.hs
testsuite/tests/indexed-types/should_fail/T13972.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T13972.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T