summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-06-02 17:15:27 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-14 15:35:23 -0400
commite4137c486a3df66b49395beea7efc6e200cc9bac (patch)
tree3b6cbf1c654586d132e4c667531e82e1ad642e38
parent9a7462fb6b8bdd6326a607bbd7b9453eb588193b (diff)
downloadhaskell-e4137c486a3df66b49395beea7efc6e200cc9bac.tar.gz
testsuite: Add tests for #18227
T18227A is the original issue which gave rise to the ticket and depends upon bytestring. T18227B is a minimized reproducer.
-rw-r--r--testsuite/tests/codeGen/should_compile/T18227A.hs6
-rw-r--r--testsuite/tests/codeGen/should_compile/T18227B.hs16
-rw-r--r--testsuite/tests/codeGen/should_compile/all.T2
3 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_compile/T18227A.hs b/testsuite/tests/codeGen/should_compile/T18227A.hs
new file mode 100644
index 0000000000..5bc76f292f
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T18227A.hs
@@ -0,0 +1,6 @@
+module T18227A (kilter) where
+import Data.ByteString.Internal
+
+kilter :: ByteString -> IO ByteString
+kilter ps@(PS x _ _) = createAndTrim 1 $ const $ pure 1
+
diff --git a/testsuite/tests/codeGen/should_compile/T18227B.hs b/testsuite/tests/codeGen/should_compile/T18227B.hs
new file mode 100644
index 0000000000..ad05a28b8f
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T18227B.hs
@@ -0,0 +1,16 @@
+-- N.B. These warnings only cause noise in stderr.
+{-# OPTIONS_GHC -Wno-overlapping-patterns -Wno-inaccessible-code #-}
+{-# LANGUAGE GADTs #-}
+
+module T18227B where
+
+import Unsafe.Coerce
+
+test1 :: UnsafeEquality Int Char -> IO ()
+test1 hi = print "hello"
+{-# NOINLINE test1 #-}
+
+test2 :: IO ()
+test2 =
+ case unsafeEqualityProof :: UnsafeEquality Int Char of
+ proof@UnsafeRefl -> test1 proof
diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T
index 2d3d0beed0..71c838de09 100644
--- a/testsuite/tests/codeGen/should_compile/all.T
+++ b/testsuite/tests/codeGen/should_compile/all.T
@@ -89,3 +89,5 @@ test('T14373d', [],
test('T17648', normal, makefile_test, [])
test('T17904', normal, compile, ['-O'])
+test('T18227A', normal, compile, [''])
+test('T18227B', normal, compile, [''])