Tidy user type errors in checkValidType
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 4 Dec 2015 12:23:33 +0000 (12:23 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 4 Dec 2015 14:21:35 +0000 (14:21 +0000)
commit67565a72f5bcd2edcb5775dc3879708f9d302fa8
treec0b93d1377048e7554a2c4ddf8c711ae2118ca95
parent31b482bfa68ec8524c4039a33ba55f0aaf02dc0b
Tidy user type errors in checkValidType

Trac #11144 showed that we need to tidy the type in the error message
generated in TcValidity.checkUserTypeError.

This is still unsatisfactory.  checkValidType was originally supposed
to be called only on types gotten directly from user-written HsTypes.
So its error messages do no tidying.  But TcBinds calls it checkValidType
on an /inferred/ type, which may need tidying.

Still this at least fixes the bad error message in CustomTypeErrors02,
which was the original ticket.

Some other small refactorings:

* Remove unused Kind result of getUserTypeErrorMsg
* Rename isUserErrorTy  -->   userTypeError_maybe
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcValidity.hs
testsuite/tests/typecheck/should_fail/CustomTypeErrors02.stderr