summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/simplCore/should_compile/T20174.hs18
-rw-r--r--testsuite/tests/simplCore/should_compile/T20174.stderr19
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
3 files changed, 38 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T20174.hs b/testsuite/tests/simplCore/should_compile/T20174.hs
new file mode 100644
index 0000000000..d89a9645d8
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T20174.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE MagicHash #-}
+{-# OPTIONS_GHC -ddump-simpl -dsuppress-all -dno-typeable-binds -O2 #-}
+
+module Test (foobar, foobar2, foobar3) where
+
+import GHC.Exts
+
+bar :: String
+bar = unpackCString# "bar"#
+
+foobar :: String
+foobar = unpackAppendCString# "foo"# bar
+
+foobar2 :: String
+foobar2 = unpackAppendCString# "foo"# (unpackCString# "bar"#)
+
+foobar3 :: String
+foobar3 = unpackAppendCString# "foo"# (unpackAppendCString# "bar"# [])
diff --git a/testsuite/tests/simplCore/should_compile/T20174.stderr b/testsuite/tests/simplCore/should_compile/T20174.stderr
new file mode 100644
index 0000000000..17141396a3
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T20174.stderr
@@ -0,0 +1,19 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 9, types: 4, coercions: 0, joins: 0/0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+foobar1 = "foobar"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
+foobar = unpackCString# foobar1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+foobar2 = foobar
+
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+foobar3 = foobar
+
+
+
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 616a469746..dbec3b3066 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -369,3 +369,4 @@ test('T19794', normal, compile, ['-O'])
test('T19890', [ grep_errmsg(r'= T19890.foo1') ], compile, ['-O -ddump-simpl'])
test('T20125', [ grep_errmsg(r'= T20125.MkT') ], compile, ['-O -ddump-simpl -dsuppress-uniques'])
test('T20143', [ grep_errmsg(r'unsafeEqualityProof') ], compile, ['-O -ddump-simpl -dsuppress-uniques'])
+test('T20174', normal, compile, [''])