[commit: ghc] master: Fix typechecking for pattern synonym signatures (f40e122)

git at git.haskell.org git at git.haskell.org
Tue Dec 22 13:33:56 UTC 2015


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

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

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

commit f40e122b7709c11d4ad20fd5cb26bf719235dbf1
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Dec 22 14:33:35 2015 +0100

    Fix typechecking for pattern synonym signatures
    
    Various tickets have revealed bad shortcomings in the typechecking of
    pattern type synonyms.  Discussed a lot in (the latter part of)
    Trac #11224.
    
    This patch fixes the most complex issues:
    
    - Both parser and renamer now treat pattern synonyms as an
      ordinary LHsSigType.  Nothing special.  Hooray.
    
    - tcPatSynSig (now in TcPatSyn) typechecks the signature, and
      decomposes it into its pieces.
      See Note [Pattern synonym signatures]
    
    - tcCheckPatSyn has had a lot of refactoring.
      See Note [Checking against a pattern signature]
    
    The result is a lot tidier and more comprehensible.
    Plus, it actually works!
    
    NB: this patch doesn't actually address the precise
        target of #11224, namely "inlining pattern synonym
        does not preserve semantics".  That's an unrelated
        bug, with a separate patch.
    
    ToDo: better documentation in the user manual
    
    Test Plan: Validate
    
    Reviewers: austin, hvr, goldfire
    
    Subscribers: goldfire, mpickering, thomie, simonpj
    
    Differential Revision: https://phabricator.haskell.org/D1685
    
    GHC Trac Issues: #11224


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

f40e122b7709c11d4ad20fd5cb26bf719235dbf1
 compiler/basicTypes/PatSyn.hs                      |   2 +-
 compiler/ghci/RtClosureInspect.hs                  |   2 +-
 compiler/hsSyn/HsBinds.hs                          |   9 +-
 compiler/parser/Parser.y                           |  21 +-
 compiler/typecheck/Inst.hs                         |   4 +-
 compiler/typecheck/TcBinds.hs                      |  44 +--
 compiler/typecheck/TcExpr.hs                       |   8 +-
 compiler/typecheck/TcHsType.hs                     |   4 +-
 compiler/typecheck/TcMType.hs                      |  55 +--
 compiler/typecheck/TcPat.hs                        |   6 +-
 compiler/typecheck/TcPatSyn.hs                     | 378 +++++++++++++++------
 compiler/typecheck/TcPatSyn.hs-boot                |   5 +-
 compiler/typecheck/TcRnTypes.hs                    |  13 +-
 compiler/typecheck/TcUnify.hs                      |   4 +-
 compiler/types/TyCoRep.hs                          |  29 +-
 testsuite/tests/patsyn/should_compile/MoreEx.hs    |  20 ++
 testsuite/tests/patsyn/should_compile/T11224b.hs   |  17 +
 testsuite/tests/patsyn/should_compile/all.T        |   3 +
 testsuite/tests/patsyn/should_fail/T11010.stderr   |  20 +-
 .../tests/patsyn/should_fail/T9793-fail.stderr     |   5 +-
 .../tests/patsyn/should_fail/as-pattern.stderr     |   5 +-
 testsuite/tests/patsyn/should_run/T11224.hs        |   7 +-
 testsuite/tests/patsyn/should_run/all.T            |   1 +
 23 files changed, 418 insertions(+), 244 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 f40e122b7709c11d4ad20fd5cb26bf719235dbf1


More information about the ghc-commits mailing list