[commit: ghc] master: Smarter HsType pretty-print for promoted datacons (ae2c9b4)

git at git.haskell.org git at git.haskell.org
Thu Nov 15 11:53:33 UTC 2018


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

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

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

commit ae2c9b40f5b6bf272251d1f4107c60003f541b62
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Nov 15 09:02:11 2018 +0000

    Smarter HsType pretty-print for promoted datacons
    
    Fix Trac #15898, by being smarter about when to print
    a space before a promoted data constructor, in a HsType.
    I had to implement a mildly tiresome function
        HsType.lhsTypeHasLeadingPromotionQuote
    It has multiple cases, of course, but it's very simple.
    
    The patch improves the error-message output in a bunch of
    cases, and (to my surprise) actually fixes a bug in the
    output of T14343 (Trac #14343), thus
    
      -  In the expression: _ :: Proxy '('( 'True,  'False),  'False)
      +  In the expression: _ :: Proxy '( '( 'True, 'False), 'False)
    
    I discovered that there were two copies of the PromotionFlag
    type (a boolean, with helpfully named data cons), one in
    IfaceType and one in HsType.  So I combined into one,
    PromotionFlag, and moved it to BasicTypes.  That's why
    quite a few files are touched, but it's all routine.


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

ae2c9b40f5b6bf272251d1f4107c60003f541b62
 compiler/basicTypes/BasicTypes.hs                  | 19 ++++++
 compiler/hsSyn/Convert.hs                          | 12 ++--
 compiler/hsSyn/HsTypes.hs                          | 75 +++++++++++++++-------
 compiler/iface/IfaceType.hs                        | 44 ++++++-------
 compiler/iface/TcIface.hs                          |  6 +-
 compiler/iface/ToIface.hs                          |  8 +--
 compiler/parser/Parser.y                           |  6 +-
 compiler/utils/Binary.hs                           | 11 ++++
 .../dependent/should_fail/PromotedClass.stderr     |  4 +-
 .../tests/dependent/should_fail/T15245.stderr      |  6 +-
 testsuite/tests/ghci/scripts/T15898.script         |  6 ++
 .../T5472.stdout => ghci/scripts/T15898.stdout}    |  0
 testsuite/tests/ghci/scripts/all.T                 |  1 +
 .../parser/should_compile/DumpParsedAst.stderr     |  2 +-
 .../parser/should_compile/DumpRenamedAst.stderr    |  2 +-
 .../tests/parser/should_compile/KindSigs.stderr    |  2 +-
 testsuite/tests/polykinds/PolyKinds07.stderr       | 12 ++--
 testsuite/tests/polykinds/T10503.stderr            |  2 +-
 testsuite/tests/polykinds/T15116a.stderr           |  4 +-
 testsuite/tests/polykinds/T7433.stderr             |  2 +-
 testsuite/tests/printer/T14343.stderr              |  8 +--
 testsuite/tests/printer/T14343b.stderr             | 12 ++--
 .../tests/typecheck/should_fail/T14607.stderr      | 12 ++--
 23 files changed, 161 insertions(+), 95 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 ae2c9b40f5b6bf272251d1f4107c60003f541b62


More information about the ghc-commits mailing list