Refactor UnliftedNewtypes-relation kind signature validity checks
This fixes three infelicities related to the programs that are (and aren't) accepted with `UnliftedNewtypes`: * Enabling `UnliftedNewtypes` would permit newtypes to have return kind `Id Type`, which had disastrous results (i.e., GHC panics). * Data family declarations ending in kind `TYPE r` (for some `r`) weren't being accepted if `UnliftedNewtypes` wasn't enabled, despite the GHC proposal specifying otherwise. * GHC wasn't warning about programs that _would_ typecheck if `UnliftedNewtypes` were enabled in certain common cases. As part of fixing these issues, I factored out the logic for checking all of the various properties about data type/data family return kinds into a single `checkDataKindSig` function. I also cleaned up some of the formatting in the existing error message that gets thrown. Fixes #16821, fixes #16827, and fixes #16829.
Showing
- compiler/typecheck/TcHsType.hs 97 additions, 8 deletionscompiler/typecheck/TcHsType.hs
- compiler/typecheck/TcInstDcls.hs 1 addition, 11 deletionscompiler/typecheck/TcInstDcls.hs
- compiler/typecheck/TcTyClsDecls.hs 10 additions, 20 deletionscompiler/typecheck/TcTyClsDecls.hs
- docs/users_guide/glasgow_exts.rst 35 additions, 16 deletionsdocs/users_guide/glasgow_exts.rst
- testsuite/tests/typecheck/should_compile/T16827.hs 8 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T16827.hs
- testsuite/tests/typecheck/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T14048a.stderr 2 additions, 2 deletionstestsuite/tests/typecheck/should_fail/T14048a.stderr
- testsuite/tests/typecheck/should_fail/T14048b.stderr 2 additions, 3 deletionstestsuite/tests/typecheck/should_fail/T14048b.stderr
- testsuite/tests/typecheck/should_fail/T14048c.stderr 2 additions, 2 deletionstestsuite/tests/typecheck/should_fail/T14048c.stderr
- testsuite/tests/typecheck/should_fail/T16821.hs 16 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T16821.hs
- testsuite/tests/typecheck/should_fail/T16821.stderr 5 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T16821.stderr
- testsuite/tests/typecheck/should_fail/T16829a.hs 10 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T16829a.hs
- testsuite/tests/typecheck/should_fail/T16829a.stderr 6 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T16829a.stderr
- testsuite/tests/typecheck/should_fail/T16829b.hs 11 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T16829b.hs
- testsuite/tests/typecheck/should_fail/T16829b.stderr 6 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T16829b.stderr
- testsuite/tests/typecheck/should_fail/UnliftedNewtypesConstraintFamily.stderr 5 additions, 5 deletions...check/should_fail/UnliftedNewtypesConstraintFamily.stderr
- testsuite/tests/typecheck/should_fail/all.T 3 additions, 0 deletionstestsuite/tests/typecheck/should_fail/all.T
Loading
Please register or sign in to comment