Fix #13777 by improving the underdetermined CUSK error message
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 3 Jun 2018 01:16:40 +0000 (21:16 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sun, 3 Jun 2018 03:21:00 +0000 (23:21 -0400)
commitac91d07399207f4e22467bea3577cafd27a937d7
tree2b446be27356693466f4c0ac4cccebd73dd605ae
parentc2783ccf545faabd21a234a4dfc569cd856082b9
Fix #13777 by improving the underdetermined CUSK error message

The error message that GHC emits from underdetermined CUSKs
is rather poor, since:

1. It may print an empty list of user-written variables if there
    are none in the declaration.
2. It may not mention any `forall`-bound, underdetermined
    variables in the result kind.

To resolve these issues, this patch:

1. Doesn't bother printing a herald about user-written
    variables if there are none.
2. Prints the result kind to advertise any
    underdetermination it may exhibit.

Test Plan: make test TEST=T13777

Reviewers: goldfire, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #13777

Differential Revision: https://phabricator.haskell.org/D4771
compiler/typecheck/TcHsType.hs
testsuite/tests/indexed-types/should_fail/T13777.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T13777.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T
testsuite/tests/polykinds/T11648b.stderr
testsuite/tests/typecheck/should_fail/T14904a.stderr