diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-09-23 08:15:13 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-09-23 08:15:13 -0400 |
commit | e68b439fe5de61b9a2ca51af472185c62ccb8b46 (patch) | |
tree | 332f26c79fd4b5a4eab866abf69da113fba3295d /testsuite | |
parent | 2dbf88b3558c3b53a1207fb504232c3da67b266e (diff) | |
download | haskell-e68b439fe5de61b9a2ca51af472185c62ccb8b46.tar.gz |
Add a recursivity check in nonVoid
Summary:
Previously `nonVoid` outright refused to call itself
recursively to avoid the risk of hitting infinite loops when
checking recurisve types. But this is too conservative—we //can//
call `nonVoid` recursively as long as we incorporate a way to detect
the presence of recursive types, and bail out if we do detect one.
Happily, such a mechanism already exists in the form of `checkRecTc`,
so let's use it.
Test Plan: make test TEST=T15584
Reviewers: simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, carter
GHC Trac Issues: #15584
Differential Revision: https://phabricator.haskell.org/D5116
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/T15584.hs | 15 | ||||
-rw-r--r-- | testsuite/tests/pmcheck/should_compile/all.T | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T15584.hs b/testsuite/tests/pmcheck/should_compile/T15584.hs new file mode 100644 index 0000000000..c5d38bb32f --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T15584.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE EmptyCase #-} +{-# OPTIONS -Wincomplete-patterns #-} +module T15584 where + +import Data.Void + +data V = MkV !Void +data S1 = MkS1 !V +newtype S2 = MkS2 V + +s1 :: S1 -> a +s1 x = case x of {} + +s2 :: S2 -> a +s2 x = case x of {} diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index f2bbfffc00..20eef3ff95 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -69,6 +69,8 @@ test('T15385', normal, compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) test('T15450', normal, compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) +test('T15584', normal, compile, + ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) # Other tests test('pmc001', [], compile, |