Reject class instances with type families in kinds
authorRyan Scott <ryan.gl.scott@gmail.com>
Sun, 2 Sep 2018 20:03:53 +0000 (22:03 +0200)
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>
Sun, 2 Sep 2018 20:03:53 +0000 (22:03 +0200)
commit6dea7c161e458ddb3ea4afd366887c8d963c6585
tree6bfdf85a9c641cdbb94850a0049c288fb2d22232
parent565ef4cc036905f9f9801c1e775236bb007b026c
Reject class instances with type families in kinds

Summary:
GHC doesn't know how to handle type families that appear in
class instances. Unfortunately, GHC didn't reject instances where
type families appear in //kinds//, leading to #15515. This is easily
rectified by calling `checkValidTypePat` on all arguments to a class
in an instance (and not just the type arguments).

Test Plan: make test TEST=T15515

Reviewers: bgamari, goldfire, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, carter

GHC Trac Issues: #15515

Differential Revision: https://phabricator.haskell.org/D5068
compiler/typecheck/TcValidity.hs
compiler/types/Type.hs
testsuite/tests/indexed-types/should_fail/SimpleFail13.stderr
testsuite/tests/indexed-types/should_fail/T2203a.stderr
testsuite/tests/indexed-types/should_fail/T9097.stderr
testsuite/tests/polykinds/T11520.stderr
testsuite/tests/typecheck/should_fail/T13909.stderr
testsuite/tests/typecheck/should_fail/T15515.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T15515.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T