[commit: ghc] master: Some tidying up of type pretty-printing (ad14efd)

git at git.haskell.org git at git.haskell.org
Fri May 26 12:22:45 UTC 2017


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

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

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

commit ad14efd539377aaf472ad69449dcaf3e679b0e51
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu May 25 16:18:06 2017 +0100

    Some tidying up of type pretty-printing
    
    Triggered by the changes in #13677, I ended up doing a bit of
    refactoring in type pretty-printing.
    
    * We were using TyOpPrec and FunPrec rather inconsitently, so
      I made it consisent.
    
    * That exposed the fact that we were a bit undecided about whether
      to print
         a + b -> c + d   vs   (a+b) -> (c+d)
      and similarly
         a ~ [b] => blah  vs   (a ~ [b]) => blah
    
      I decided to make TyOpPrec and FunPrec compare equal
      (in BasicTypes), so (->) is treated as equal precedence with
      other type operators, so you get the unambiguous forms above,
      even though they have more parens.
    
      We could readily reverse this decision.
      See Note [Type operator precedence] in BasicTypes
    
    * I fixed a bug in pretty-printing of HsType where some
      parens were omitted by mistake.


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

ad14efd539377aaf472ad69449dcaf3e679b0e51
 compiler/basicTypes/BasicTypes.hs                  | 57 +++++++++++++-
 compiler/hsSyn/HsTypes.hs                          |  4 +-
 compiler/iface/IfaceType.hs                        | 87 ++++++++++++----------
 compiler/typecheck/TcErrors.hs                     |  2 +-
 compiler/typecheck/TcType.hs                       |  2 +-
 compiler/types/TyCoRep.hs                          | 32 ++++----
 compiler/types/Type.hs                             |  3 +-
 .../tests/backpack/should_fail/bkpfail24.stderr    |  6 +-
 testsuite/tests/gadt/T7558.stderr                  |  2 +-
 .../tests/generics/T10604/T10604_deriving.stderr   |  2 +-
 testsuite/tests/ghci/scripts/T12024.stdout         |  3 +-
 .../haddock/haddock_examples/haddock.Test.stderr   | 22 +++---
 .../should_compile_flag_haddock/haddockA023.stderr |  2 +-
 .../should_compile_flag_haddock/haddockA024.stderr |  2 +-
 .../should_compile_flag_haddock/haddockA025.stderr |  2 +-
 .../should_compile_flag_haddock/haddockA026.stderr |  3 +-
 .../should_compile_flag_haddock/haddockA027.stderr |  4 +-
 .../should_compile_flag_haddock/haddockA028.stderr |  2 +-
 .../should_compile/PushedInAsGivens.stderr         |  2 +-
 .../indexed-types/should_compile/Simple14.stderr   |  6 +-
 .../indexed-types/should_fail/SimpleFail15.stderr  |  5 +-
 .../tests/indexed-types/should_fail/T4093a.stderr  |  4 +-
 .../should_compile/DataFamilyInstanceLHS.stderr    |  4 +-
 .../should_compile/EqualityConstraint.stderr       |  2 +-
 .../NamedWildcardInDataFamilyInstanceLHS.stderr    |  4 +-
 testsuite/tests/polykinds/T10503.stderr            |  7 +-
 testsuite/tests/polykinds/T7230.stderr             |  2 +-
 testsuite/tests/polykinds/T7328.stderr             |  2 +-
 testsuite/tests/polykinds/T9222.stderr             |  4 +-
 .../tests/roles/should_compile/Roles13.stderr      |  2 +-
 testsuite/tests/roles/should_compile/Roles3.stderr |  4 +-
 .../tests/typecheck/should_compile/T10632.stderr   |  2 +-
 .../typecheck/should_fail/ClassOperator.stderr     |  8 +-
 .../typecheck/should_fail/FrozenErrorTests.stderr  |  2 +-
 .../tests/typecheck/should_fail/IPFail.stderr      |  2 +-
 .../tests/typecheck/should_fail/T12921.stderr      |  2 +-
 testsuite/tests/typecheck/should_fail/T5858.stderr |  2 +-
 .../tests/typecheck/should_fail/T7019a.stderr      |  2 +-
 testsuite/tests/typecheck/should_fail/T7525.stderr |  4 +-
 testsuite/tests/typecheck/should_fail/T7857.stderr |  2 +-
 testsuite/tests/typecheck/should_fail/T8912.stderr |  2 +-
 .../tests/typecheck/should_fail/tcfail041.stderr   |  2 +-
 .../tests/typecheck/should_fail/tcfail211.stderr   |  4 +-
 43 files changed, 191 insertions(+), 128 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 ad14efd539377aaf472ad69449dcaf3e679b0e51


More information about the ghc-commits mailing list