[GHC] #15450: Inconsistency w.r.t. coverage checking warnings for EmptyCase under unsatisfiable constraints

GHC ghc-devs at haskell.org
Wed Aug 1 23:39:43 UTC 2018


#15450: Inconsistency w.r.t. coverage checking warnings for EmptyCase under
unsatisfiable constraints
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #12957            |  Differential Rev(s):  Phab:D5017
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"7f3cb50dd311caefb536d582f1e3d1b33d6650f6/ghc"
 7f3cb50d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="7f3cb50dd311caefb536d582f1e3d1b33d6650f6"
 Fix #15450 by refactoring checkEmptyCase'

 `checkEmptyCase'` (the code path for coverage-checking
 `EmptyCase` expressions) had a fair bit of code duplication from the
 code path for coverage-checking non-`EmptyCase` expressions, and to
 make things worse, it behaved subtly different in some respects (for
 instance, emitting different warnings under unsatisfiable
 constraints, as shown in #15450). This patch attempts to clean up
 both this discrepancy and the code duplication by doing the
 following:

 * Factor out a `pmInitialTmTyCs` function, which returns the initial
   set of term and type constraints to use when beginning coverage
   checking. If either set of constraints is unsatisfiable, we use an
   empty set in its place so that we can continue to emit as many
   warnings as possible. (The code path for non-`EmptyCase`
   expressions was doing this already, but not the code path for
   `EmptyCase` expressions, which is the root cause of #15450.)

   Along the way, I added a `Note` to explain why we do this.
 * Factor out a `pmIsSatisfiable` constraint which checks if a set of
   term and type constraints are satisfiable. This does not change any
   existing behavior; this is just for the sake of deduplicating code.

 Test Plan: make test TEST=T15450

 Reviewers: simonpj, bgamari

 Subscribers: rwbarton, thomie, carter

 GHC Trac Issues: #15450

 Differential Revision: https://phabricator.haskell.org/D5017
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15450#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list