[commit: ghc] master: Provide a better error message for unpromotable data constructor contexts (c637541)

git at git.haskell.org git at git.haskell.org
Sun Jun 17 18:40:50 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c63754118cf6c3d0947d0c611f1db39c78acf1b7/ghc

>---------------------------------------------------------------

commit c63754118cf6c3d0947d0c611f1db39c78acf1b7
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Sun Jun 17 12:28:23 2018 -0400

    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


>---------------------------------------------------------------

c63754118cf6c3d0947d0c611f1db39c78acf1b7
 compiler/typecheck/Inst.hs                         | 15 ++------
 compiler/typecheck/TcHsType.hs                     | 40 +++++++++++++++++++++-
 compiler/typecheck/TcRnTypes.hs                    | 39 ++++++++++++---------
 docs/users_guide/glasgow_exts.rst                  | 22 +++++++++---
 .../dependent/should_compile/T14845_compile.hs     | 16 +++++++++
 testsuite/tests/dependent/should_compile/all.T     |  1 +
 .../dependent/should_fail/PromotedClass.stderr     |  3 +-
 testsuite/tests/dependent/should_fail/T13895.hs    | 15 ++++++++
 .../tests/dependent/should_fail/T13895.stderr      | 20 +++++++++++
 .../tests/dependent/should_fail/T14845.stderr      |  7 ++++
 .../tests/dependent/should_fail/T14845_fail1.hs    | 10 ++++++
 .../dependent/should_fail/T14845_fail1.stderr      |  7 ++++
 .../should_fail/{T15215.hs => T14845_fail2.hs}     |  6 ++--
 .../dependent/should_fail/T14845_fail2.stderr      |  7 ++++
 .../tests/dependent/should_fail/T15215.stderr      |  2 +-
 testsuite/tests/dependent/should_fail/all.T        |  3 ++
 16 files changed, 174 insertions(+), 39 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c63754118cf6c3d0947d0c611f1db39c78acf1b7


More information about the ghc-commits mailing list