summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSebastian Graf <sgraf1337@gmail.com>2019-09-16 16:52:21 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-09-28 17:11:41 -0400
commitc5d888d41eb7b39ea0d4c4aabd07ce8133bfeae6 (patch)
tree6561c3d6eaf34ef0e322bb450a0211841752bdd4 /testsuite/tests
parent6f9fa0be8d43a7c9618f6e27e3190dc08bf86bfa (diff)
downloadhaskell-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')
-rw-r--r--testsuite/tests/pmcheck/should_compile/T17234.hs8
-rw-r--r--testsuite/tests/pmcheck/should_compile/T17234.stderr4
-rw-r--r--testsuite/tests/pmcheck/should_compile/all.T2
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,