Only skip decls with CUSKs in kcLTyClDecl with PolyKinds on
Summary
Data type kind checking skips decls with CUSKs in kcLTyClDecl
(see note [Skip decls with CUSKs in kcLTyClDecl] in TcTyClsDecls
).
However, when we have no PolyKinds, we shouldn't skip the check, because we have defaulting. Skipping won't bring us more polymorphism when we have defaulting.
WITHOUT any language extension, the following program is rejected nowadays.
data T1 a = MkT1 T2
data T2 = MkT2 (T1 Maybe)
What happened: T1
and T2
are in the same recursive group. Since T2
has a CUSK (which is Type
), (T1 Maybe)
is skipped when kind-checking. So the kind of a
remains unsolved and is thus defaulted to Type
. Then (T1 Maybe)
fails to type-check because of a kind mismatch between Type
and Type -> Type
.
The program type-checks in GHC 8.4 but fails to type-check since GHC 8.6.
Propose: when we have NoPolyKinds, we don't skip the check; when we have PolyKinds, we skip the check.
Steps to reproduce
Type-check the example program.
Expected behavior
The program should type-check.
Environment
- GHC version used: since 8.6