Improve error reports for kind checking (Trac #2994)