summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-02-08 16:12:36 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-02-08 16:18:14 +0000
commit3cfef763ab6ccd23f72604e5ee2f027a4b6ce043 (patch)
treeefc865f693cad0c11bdf45df0cc1a9b556022a24 /testsuite
parent9f3c1e67e5731124e499a420df52397b652876c8 (diff)
downloadhaskell-3cfef763ab6ccd23f72604e5ee2f027a4b6ce043.tar.gz
Kill inaccessible-branch complaints in record update
Trac #12957 (the original case in the Description) showed a record update that yielded an "inaccessible code" warning. This should not happen; it's just some redundant code generated by the desugarer (later pruned away) and it's not the user's fault. This patch suppresses the warning. See Check.hs Note [Inaccessible warnings for record updates]
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/pmcheck/should_compile/T12957a.hs25
-rw-r--r--testsuite/tests/pmcheck/should_compile/all.T1
2 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/pmcheck/should_compile/T12957a.hs b/testsuite/tests/pmcheck/should_compile/T12957a.hs
new file mode 100644
index 0000000000..72330e98e0
--- /dev/null
+++ b/testsuite/tests/pmcheck/should_compile/T12957a.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE RecordWildCards #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE GADTs #-}
+{-# LANGUAGE KindSignatures #-}
+
+-- The original test case for Trac #12957
+
+module T12957a where
+
+data T = A | B
+
+data Fields (t :: T) where
+ BFields :: { list :: [()] } -> Fields 'B
+
+ AFields :: Fields 'A
+
+ EmptyFields :: Fields t
+
+emptyA :: Fields 'A
+emptyA = AFields
+
+data S t = S { sFields :: Fields t }
+
+f :: () -> S 'A
+f a = (S EmptyFields) { sFields = emptyA { list = [ a ] } }
diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T
index 7fc4fc5310..874535807d 100644
--- a/testsuite/tests/pmcheck/should_compile/all.T
+++ b/testsuite/tests/pmcheck/should_compile/all.T
@@ -60,6 +60,7 @@ test('pmc007', [], compile,
test('T11245', [], compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T12957', [], compile, ['-fwarn-overlapping-patterns'])
+test('T12957a', [], compile, ['-fwarn-overlapping-patterns'])
# EmptyCase
test('T10746', [], compile,