testsuite: Add test for #16509
authorBen Gamari <ben@smart-cactus.org>
Tue, 28 May 2019 03:00:16 +0000 (23:00 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Sun, 9 Jun 2019 22:46:08 +0000 (18:46 -0400)
testsuite/tests/patsyn/should_compile/T16509.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_compile/T16509.script [new file with mode: 0644]
testsuite/tests/patsyn/should_compile/all.T

diff --git a/testsuite/tests/patsyn/should_compile/T16509.hs b/testsuite/tests/patsyn/should_compile/T16509.hs
new file mode 100644 (file)
index 0000000..b848811
--- /dev/null
@@ -0,0 +1,12 @@
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE ViewPatterns #-}
+
+module PatternPanic where
+
+pattern TestPat :: (Int, Int)
+pattern TestPat <- (isSameRef -> True, 0)
+
+isSameRef :: Int -> Bool
+isSameRef e | 0 <- e = True
+isSameRef _ = False
+
diff --git a/testsuite/tests/patsyn/should_compile/T16509.script b/testsuite/tests/patsyn/should_compile/T16509.script
new file mode 100644 (file)
index 0000000..fd4714a
--- /dev/null
@@ -0,0 +1 @@
+:load T16509.hs
index 2ac343f..15369b6 100644 (file)
@@ -77,5 +77,6 @@ test('T14326', normal, compile, [''])
 test('T14394', normal, ghci_script, ['T14394.script'])
 test('T14552', normal, compile, [''])
 test('T14498', normal, compile, [''])
+test('T16509', expect_broken(16509), ghci_script, ['T16509.script'])
 test('T16682', [extra_files(['T16682.hs', 'T16682a.hs'])],
                multimod_compile, ['T16682', '-v0 -fwarn-incomplete-patterns -fno-code'])