diff options
author | Sebastian Graf <sgraf1337@gmail.com> | 2019-09-16 16:52:21 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-28 17:11:41 -0400 |
commit | c5d888d41eb7b39ea0d4c4aabd07ce8133bfeae6 (patch) | |
tree | 6561c3d6eaf34ef0e322bb450a0211841752bdd4 /testsuite/tests/pmcheck | |
parent | 6f9fa0be8d43a7c9618f6e27e3190dc08bf86bfa (diff) | |
download | haskell-c5d888d41eb7b39ea0d4c4aabd07ce8133bfeae6.tar.gz |
PmCheck: No ConLike instantiation in pmcheck
`pmcheck` used to call `refineToAltCon` which would refine the knowledge
we had about a variable by equating it to a `ConLike` application.
Since we weren't particularly smart about this in the Check module, we
simply freshened the constructors existential and term binders utimately
through a call to `mkOneConFull`.
But that instantiation is unnecessary for when we match against a
concrete pattern! The pattern will already have fresh binders and field
types. So we don't call `refineToAltCon` from `Check` anymore.
Subsequently, we can simplify a couple of call sites and functions in
`PmOracle`. Also implementing `computeCovered` becomes viable and we
don't have to live with the hack that was `addVarPatVecCt` anymore.
A side-effect of not indirectly calling `mkOneConFull` anymore is that
we don't generate the proper strict argument field constraints anymore.
Instead we now desugar ConPatOuts as if they had bangs on their strict
fields. This implies that `PmVar` now carries a `HsImplBang` that we
need to respect by a (somewhat ephemeral) non-void check. We fix #17234
in doing so.
Diffstat (limited to 'testsuite/tests/pmcheck')
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/T17234.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/T17234.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/all.T | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T17234.hs b/testsuite/tests/pmcheck/should_compile/T17234.hs new file mode 100644 index 0000000000..27025d430a --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T17234.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE BangPatterns #-} + +module Lib where + +import Data.Void + +f :: Void -> () +f !_ = () diff --git a/testsuite/tests/pmcheck/should_compile/T17234.stderr b/testsuite/tests/pmcheck/should_compile/T17234.stderr new file mode 100644 index 0000000000..0a1912cfab --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T17234.stderr @@ -0,0 +1,4 @@ + +T17234.hs:8:1: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match has inaccessible right hand side + In an equation for âfâ: f !_ = ... diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index e41d7f211c..19ae2c71b9 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -82,6 +82,8 @@ test('T17096', collect_compiler_stats('bytes allocated',10), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS']) test('T17112', normal, compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) +test('T17234', normal, compile, + ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) # Other tests test('pmc001', [], compile, |