Provide a better error message for unpromotable data constructor contexts
Trac #14845 brought to light a corner case where a data constructor could not be promoted (even with `-XTypeInType`) due to an unpromotable constraint in its context. However, the error message was less than helpful, so this patch adds an additional check to `tcTyVar` catch unpromotable data constructors like these //before// they're promoted, and to give a sensible error message in such cases. Test Plan: make test TEST="T13895 T14845" Reviewers: simonpj, goldfire, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter GHC Trac Issues: #13895, #14845 Differential Revision: https://phabricator.haskell.org/D4728
Showing
- compiler/typecheck/Inst.hs 2 additions, 13 deletionscompiler/typecheck/Inst.hs
- compiler/typecheck/TcHsType.hs 39 additions, 1 deletioncompiler/typecheck/TcHsType.hs
- compiler/typecheck/TcRnTypes.hs 23 additions, 16 deletionscompiler/typecheck/TcRnTypes.hs
- docs/users_guide/glasgow_exts.rst 17 additions, 5 deletionsdocs/users_guide/glasgow_exts.rst
- testsuite/tests/dependent/should_compile/T14845_compile.hs 16 additions, 0 deletionstestsuite/tests/dependent/should_compile/T14845_compile.hs
- testsuite/tests/dependent/should_compile/all.T 2 additions, 1 deletiontestsuite/tests/dependent/should_compile/all.T
- testsuite/tests/dependent/should_fail/PromotedClass.stderr 2 additions, 1 deletiontestsuite/tests/dependent/should_fail/PromotedClass.stderr
- testsuite/tests/dependent/should_fail/T13895.hs 15 additions, 0 deletionstestsuite/tests/dependent/should_fail/T13895.hs
- testsuite/tests/dependent/should_fail/T13895.stderr 20 additions, 0 deletionstestsuite/tests/dependent/should_fail/T13895.stderr
- testsuite/tests/dependent/should_fail/T14845.stderr 7 additions, 0 deletionstestsuite/tests/dependent/should_fail/T14845.stderr
- testsuite/tests/dependent/should_fail/T14845_fail1.hs 10 additions, 0 deletionstestsuite/tests/dependent/should_fail/T14845_fail1.hs
- testsuite/tests/dependent/should_fail/T14845_fail1.stderr 7 additions, 0 deletionstestsuite/tests/dependent/should_fail/T14845_fail1.stderr
- testsuite/tests/dependent/should_fail/T14845_fail2.hs 14 additions, 0 deletionstestsuite/tests/dependent/should_fail/T14845_fail2.hs
- testsuite/tests/dependent/should_fail/T14845_fail2.stderr 7 additions, 0 deletionstestsuite/tests/dependent/should_fail/T14845_fail2.stderr
- testsuite/tests/dependent/should_fail/T15215.stderr 1 addition, 1 deletiontestsuite/tests/dependent/should_fail/T15215.stderr
- testsuite/tests/dependent/should_fail/all.T 3 additions, 0 deletionstestsuite/tests/dependent/should_fail/all.T
Loading
Please register or sign in to comment