Fix Uncovered set of literal patterns
authorSebastian Graf <sebastian.graf@kit.edu>
Mon, 1 Apr 2019 17:59:45 +0000 (19:59 +0200)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 3 Apr 2019 08:03:47 +0000 (04:03 -0400)
commit4626cf213fe7affe5f8c2d94dbf03e727c816694
treef1cd3dc77fb91aebe12e5677abdc5f9bf9f1aaa2
parent7b090b53fea065d2cfd967ea919426af9ba8d737
Fix Uncovered set of literal patterns

Issues #16289 and #15713 are proof that the pattern match checker did
an unsound job of estimating the value set abstraction corresponding to
the uncovered set.

The reason is that the fix from #11303 introducing `NLit` was
incomplete: The `LitCon` case desugared to `Var` rather than `LitVar`,
which would have done the necessary case splitting analogous to the
`ConVar` case.

This patch rectifies that by introducing the fresh unification variable
in `LitCon` in value abstraction position rather than pattern postition,
recording a constraint equating it to the constructor expression rather
than the literal. Fixes #16289 and #15713.
compiler/deSugar/Check.hs
compiler/deSugar/TmOracle.hs
testsuite/tests/pmcheck/should_compile/T15713.hs [new file with mode: 0644]
testsuite/tests/pmcheck/should_compile/T16289.hs [new file with mode: 0644]
testsuite/tests/pmcheck/should_compile/all.T