diff options
author | Sebastian Graf <sgraf1337@gmail.com> | 2019-10-18 16:06:24 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-11-05 11:38:30 -0500 |
commit | 1593debf54ab40708e1c1224c656752d4ccd1ffa (patch) | |
tree | 94ad92e8e63c842cfba65ecb870f60ca606cd312 /testsuite/tests/pmcheck/should_compile/T17248.hs | |
parent | 487ede425bd0ef958481f0ca0b9614d362e10972 (diff) | |
download | haskell-1593debf54ab40708e1c1224c656752d4ccd1ffa.tar.gz |
Check EmptyCase by simply adding a non-void constraint
We can handle non-void constraints since !1733, so we can now express
the strictness of `-XEmptyCase` just by adding a non-void constraint
to the initial Uncovered set.
For `case x of {}` we thus check that the Uncovered set `{ x | x /~ ⊥ }`
is non-empty. This is conceptually simpler than the plan outlined in
#17376, because it talks to the oracle directly.
In order for this patch to pass the testsuite, I had to fix handling of
newtypes in the pattern-match checker (#17248).
Since we use a different code path (well, the main code path) for
`-XEmptyCase` now, we apparently also handle #13717 correctly.
There's also some dead code that we can get rid off now.
`provideEvidence` has been updated to provide output more in line with
the old logic, which used `inhabitationCandidates` under the hood.
A consequence of the shift away from the `UncoveredPatterns` type is
that we don't report reduced type families for empty case matches,
because the pretty printer is pure and only knows the match variable's
type.
Fixes #13717, #17248, #17386
Diffstat (limited to 'testsuite/tests/pmcheck/should_compile/T17248.hs')
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/T17248.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T17248.hs b/testsuite/tests/pmcheck/should_compile/T17248.hs index e320bd5184..095153fb08 100644 --- a/testsuite/tests/pmcheck/should_compile/T17248.hs +++ b/testsuite/tests/pmcheck/should_compile/T17248.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} module Lib where data T1 a = T1 a @@ -10,6 +11,7 @@ f _ _ = () g :: T2 a -> Bool -> () g _ True = () -g (T2 _) True = () +g (T2 _) True = () -- redundant +g !_ True = () -- inaccessible g _ _ = () |