summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/pmcheck/should_compile/T21360.hs22
-rw-r--r--testsuite/tests/pmcheck/should_compile/all.T1
2 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T21360.hs b/testsuite/tests/pmcheck/should_compile/T21360.hs
new file mode 100644
index 0000000000..db517a35a9
--- /dev/null
+++ b/testsuite/tests/pmcheck/should_compile/T21360.hs
@@ -0,0 +1,22 @@
+{-# OPTIONS_GHC -Wincomplete-record-updates #-}
+
+module T21360 where
+
+data Foo = A {a :: Int} | B deriving Show
+
+foo = A 4
+
+-- wibble is safe - no warning
+wibble = do
+ case foo of
+ bar@A{} -> Just bar{a = 9}
+ _ -> fail ":("
+
+-- using guards doesn't throw a warning
+twomble | bar@A{} <- foo = Just bar{a = 9}
+ | otherwise = fail ":("
+
+-- sworble has the same semantics as wibble and twomble - but we get a warning!
+sworble = do
+ bar@A{} <- Just foo
+ Just bar{a = 9}
diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T
index 1af8c91441..fe63d364f7 100644
--- a/testsuite/tests/pmcheck/should_compile/all.T
+++ b/testsuite/tests/pmcheck/should_compile/all.T
@@ -89,6 +89,7 @@ test('T19384', expect_broken(19384), compile, [overlapping_incomplete])
test('T19622', normal, compile, [overlapping_incomplete])
test('T20631', normal, compile, [overlapping_incomplete])
test('T20642', normal, compile, [overlapping_incomplete])
+test('T21360', normal, compile, [overlapping_incomplete])
# Other tests
test('pmc001', [], compile, [overlapping_incomplete])