summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/pmcheck/should_compile/T11822.stderr8
-rw-r--r--testsuite/tests/pmcheck/should_compile/T21662.hs21
-rw-r--r--testsuite/tests/pmcheck/should_compile/all.T1
3 files changed, 22 insertions, 8 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T11822.stderr b/testsuite/tests/pmcheck/should_compile/T11822.stderr
index 7f0aae9aec..d2994b65aa 100644
--- a/testsuite/tests/pmcheck/should_compile/T11822.stderr
+++ b/testsuite/tests/pmcheck/should_compile/T11822.stderr
@@ -12,11 +12,3 @@ T11822.hs:33:1: warning: [-Wincomplete-patterns (in -Wextra)]
_ _
_ (Data.Sequence.Internal.Seq Data.Sequence.Internal.EmptyT) _ _
...
-
-T11822.hs:33:1: warning:
- Pattern match checker ran into -fmax-pmcheck-models=30 limit, so
- • Redundant clauses might not be reported at all
- • Redundant clauses might be reported as inaccessible
- • Patterns reported as unmatched might actually be matched
- Suggested fix:
- Increase the limit or resolve the warnings to suppress this message.
diff --git a/testsuite/tests/pmcheck/should_compile/T21662.hs b/testsuite/tests/pmcheck/should_compile/T21662.hs
new file mode 100644
index 0000000000..1a3ff6cb6e
--- /dev/null
+++ b/testsuite/tests/pmcheck/should_compile/T21662.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE AllowAmbiguousTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE ViewPatterns #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE TypeApplications #-}
+
+module T21662 where
+
+import GHC.TypeNats (Nat, KnownNat)
+
+view_fn :: forall (n :: Nat). KnownNat n => Int -> Bool
+view_fn i = i > 0
+
+foo :: Int -> Int
+foo (view_fn @12 -> True) = 0
+foo (view_fn @12 -> False) = 0
+
+ -- The point is that the two view pattern functions "view_fn"
+ -- may get different uniques for the KnownNat 12 dictionary,
+ -- which leads to a spurious pattern match warning.
diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T
index fe63d364f7..6415e83dab 100644
--- a/testsuite/tests/pmcheck/should_compile/all.T
+++ b/testsuite/tests/pmcheck/should_compile/all.T
@@ -111,6 +111,7 @@ test('CyclicSubst', [], compile, [overlapping_incomplete])
test('CaseOfKnownCon', [], compile, [overlapping_incomplete])
test('TooManyDeltas', [], compile, [overlapping_incomplete+'-fmax-pmcheck-models=0'])
test('LongDistanceInfo', [], compile, [overlapping_incomplete])
+test('T21662', [], compile, [overlapping_incomplete])
# Series (inspired) by Luke Maranget