[commit: ghc] master: Fix #15450 by refactoring checkEmptyCase' (7f3cb50)
git at git.haskell.org
git at git.haskell.org
Wed Aug 1 23:39:50 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/7f3cb50dd311caefb536d582f1e3d1b33d6650f6/ghc
>---------------------------------------------------------------
commit 7f3cb50dd311caefb536d582f1e3d1b33d6650f6
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Wed Aug 1 14:26:44 2018 -0400
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
>---------------------------------------------------------------
7f3cb50dd311caefb536d582f1e3d1b33d6650f6
compiler/deSugar/Check.hs | 137 +++++++++++++++------
testsuite/tests/pmcheck/should_compile/T15450.hs | 9 ++
.../tests/pmcheck/should_compile/T15450.stderr | 11 ++
testsuite/tests/pmcheck/should_compile/all.T | 2 +
4 files changed, 119 insertions(+), 40 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 7f3cb50dd311caefb536d582f1e3d1b33d6650f6
More information about the ghc-commits
mailing list