Fix #10815 by kind-checking type patterns against known kinds.
authorRichard Eisenberg <eir@cis.upenn.edu>
Mon, 31 Aug 2015 17:46:01 +0000 (10:46 -0700)
committerRichard Eisenberg <eir@cis.upenn.edu>
Sat, 19 Sep 2015 16:09:16 +0000 (12:09 -0400)
commit2d4db40ac07db2fc776d61aac2383608911281ff
tree50f2d8057822752f41496a2ba3c9480c28a2af70
parenta8406f81a5da077d1c4b9995654ca9972f39130c
Fix #10815 by kind-checking type patterns against known kinds.

tcFamTyPats now must take information about the instantiation of any
class variables, when checking the instance of an associated type.

Getting this to work out required some unexpected refactoring in
TcDeriv. TcDeriv needs to look at class instances because of the
possibility of associated datatypes with `deriving` specs. TcDeriv
worked over the user-specified instances. But any data family instances
were already processed, and TcDeriv had no way of finding the rep
tycons. Indeed, TcDeriv *re-type-checked* any data family instances
in an attempt to rediscover what GHC already knew. So, this commit
introduces better tracking of compiled data families between TcInstDcls
and TcDeriv to streamline all of this.
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcInstDcls.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcValidity.hs
compiler/types/TyCon.hs
testsuite/tests/ghci/scripts/T6018ghcifail.stderr
testsuite/tests/indexed-types/should_compile/T10815.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_compile/all.T
testsuite/tests/indexed-types/should_fail/T9160.stderr
testsuite/tests/typecheck/should_fail/T6018fail.stderr