summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sgraf1337@gmail.com>2019-09-18 13:53:34 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-09-19 09:05:58 -0400
commit2a8867cfa6b6aa3f8b35a9506f4058bb5d37f7dc (patch)
treef36a44205be0002adbdad6a43dc5502e19596618
parentbaf47661426e6f60c5fbfd2fb29cb446aa007576 (diff)
downloadhaskell-2a8867cfa6b6aa3f8b35a9506f4058bb5d37f7dc.tar.gz
Add a regression test for #11822
The particular test is already fixed, but the issue seems to have multiple different test cases lumped together.
-rw-r--r--testsuite/tests/pmcheck/should_compile/T11822.hs42
-rw-r--r--testsuite/tests/pmcheck/should_compile/T11822.stderr10
-rw-r--r--testsuite/tests/pmcheck/should_compile/all.T6
3 files changed, 54 insertions, 4 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T11822.hs b/testsuite/tests/pmcheck/should_compile/T11822.hs
new file mode 100644
index 0000000000..01afdf46c3
--- /dev/null
+++ b/testsuite/tests/pmcheck/should_compile/T11822.hs
@@ -0,0 +1,42 @@
+{-# OPTIONS_GHC -Wincomplete-patterns -fforce-recomp #-}
+{-# LANGUAGE OverloadedLists #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE GeneralisedNewtypeDeriving #-}
+
+module T11822 where
+
+import Data.Sequence (Seq, pattern (:<|))
+import Data.Set (Set)
+
+newtype SiblingDependencies = SiblingDependencies Int
+ deriving (Eq, Ord, Enum, Integral, Real, Num)
+
+newtype Depth = Depth Int
+ deriving (Eq, Ord, Enum, Integral, Real, Num)
+
+data TreeNode prefix
+ = OnlyChild prefix
+ | LeafLast prefix
+ | LeafMid prefix
+ | NodeLast prefix
+ | NodeMid prefix
+ | PrefixedLast prefix (Seq SiblingDependencies) (Set prefix) Depth
+ | PrefixedMid prefix (Seq SiblingDependencies) (Set prefix) Depth
+
+mkTreeNode
+ :: Ord prefix
+ => prefix
+ -> Seq SiblingDependencies
+ -> Set prefix
+ -> Depth
+ -> TreeNode prefix
+mkTreeNode t [] _ _ = OnlyChild t
+mkTreeNode t [0] [] _ = LeafLast t
+mkTreeNode t [_] [] _ = LeafMid t
+mkTreeNode t [0] _ 0 = LeafLast t
+mkTreeNode t [_] _ 0 = LeafMid t
+mkTreeNode t [0] _ _ = NodeLast t
+mkTreeNode t [_] _ _ = NodeMid t
+mkTreeNode t (0 :<| ns) ds depth = PrefixedLast t ns ds depth
+mkTreeNode t (_ :<| ns) ds depth = PrefixedMid t ns ds depth
+
diff --git a/testsuite/tests/pmcheck/should_compile/T11822.stderr b/testsuite/tests/pmcheck/should_compile/T11822.stderr
new file mode 100644
index 0000000000..c9e87c5deb
--- /dev/null
+++ b/testsuite/tests/pmcheck/should_compile/T11822.stderr
@@ -0,0 +1,10 @@
+
+T11822.hs:33:1: warning: [-Wincomplete-patterns (in -Wextra)]
+ Pattern match(es) are non-exhaustive
+ In an equation for ‘mkTreeNode’:
+ Patterns not matched:
+ _ (Data.Sequence.Internal.Seq _) _ _
+ _ (Data.Sequence.Internal.Seq _) _ p where p is not one of {0}
+ _ (Data.Sequence.Internal.Seq _) _ p where p is not one of {0}
+ _ (Data.Sequence.Internal.Seq _) _ p where p is not one of {0}
+ ...
diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T
index 5a24832945..9c38d636eb 100644
--- a/testsuite/tests/pmcheck/should_compile/all.T
+++ b/testsuite/tests/pmcheck/should_compile/all.T
@@ -40,16 +40,14 @@ test('T11303', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS'])
test('T11276', collect_compiler_stats('bytes allocated',10), compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS'])
-
test('T11303b', collect_compiler_stats('bytes allocated',10), compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS'])
-
test('T11374', collect_compiler_stats('bytes allocated',10), compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS'])
-
+test('T11822', collect_compiler_stats('bytes allocated',10), compile,
+ ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T11195', collect_compiler_stats('bytes allocated',10), compile,
['-package ghc -fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS'])
-
test('T11984', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T14086', normal, compile,