[commit: ghc] master: Exhaustiveness check for EmptyCase (Trac #10746) (b103532)

git at git.haskell.org git at git.haskell.org
Thu Feb 2 19:58:10 UTC 2017


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

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

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

commit b10353216f5ff5d5e410334e4c118b6695b628d0
Author: George Karachalias <george.karachalias at gmail.com>
Date:   Thu Feb 2 13:51:33 2017 -0500

    Exhaustiveness check for EmptyCase (Trac #10746)
    
    Empty case expressions have strict semantics so the problem boils down
    to inhabitation checking for the type of the scrutinee. 3 main functions
    added:
    
    - pmTopNormaliseType_maybe for the normalisation of the scrutinee type
    
    - inhabitationCandidates for generating the possible patterns of the
      appropriate type
    
    - checkEmptyCase' to filter out the candidates that give rise to
      unsatisfiable constraints.
    
    See Note [Checking EmptyCase Expressions] in Check
    and Note [Type normalisation for EmptyCase] in FamInstEnv
    
    Test Plan: validate
    
    Reviewers: simonpj, goldfire, dfeuer, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: mpickering, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2105
    
    GHC Trac Issues: #10746


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

b10353216f5ff5d5e410334e4c118b6695b628d0
 compiler/deSugar/Check.hs                          | 194 +++++++++++++++++++--
 compiler/types/FamInstEnv.hs                       | 114 +++++++++++-
 compiler/types/Type.hs                             |   8 +-
 .../tests/pmcheck/should_compile/EmptyCase001.hs   |  18 ++
 .../pmcheck/should_compile/EmptyCase001.stderr     |  14 ++
 .../tests/pmcheck/should_compile/EmptyCase002.hs   |  54 ++++++
 .../pmcheck/should_compile/EmptyCase002.stderr     |  22 +++
 .../tests/pmcheck/should_compile/EmptyCase003.hs   |  95 ++++++++++
 .../pmcheck/should_compile/EmptyCase003.stderr     |  11 ++
 .../tests/pmcheck/should_compile/EmptyCase004.hs   |  49 ++++++
 .../pmcheck/should_compile/EmptyCase004.stderr     |  36 ++++
 .../tests/pmcheck/should_compile/EmptyCase005.hs   | 101 +++++++++++
 .../pmcheck/should_compile/EmptyCase005.stderr     |  32 ++++
 .../tests/pmcheck/should_compile/EmptyCase006.hs   |  28 +++
 .../pmcheck/should_compile/EmptyCase006.stderr     |  11 ++
 .../tests/pmcheck/should_compile/EmptyCase007.hs   |  46 +++++
 .../pmcheck/should_compile/EmptyCase007.stderr     |  26 +++
 .../tests/pmcheck/should_compile/EmptyCase008.hs   |  52 ++++++
 .../pmcheck/should_compile/EmptyCase008.stderr     |  18 ++
 .../tests/pmcheck/should_compile/EmptyCase009.hs   |  40 +++++
 .../pmcheck/should_compile/EmptyCase009.stderr     |  11 ++
 .../tests/pmcheck/should_compile/EmptyCase010.hs   |  71 ++++++++
 .../pmcheck/should_compile/EmptyCase010.stderr     |  41 +++++
 testsuite/tests/pmcheck/should_compile/T10746.hs   |  25 +++
 .../tests/pmcheck/should_compile/T10746.stderr     |   6 +
 testsuite/tests/pmcheck/should_compile/all.T       |  24 +++
 26 files changed, 1128 insertions(+), 19 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 b10353216f5ff5d5e410334e4c118b6695b628d0


More information about the ghc-commits mailing list