summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2016-09-15 17:06:16 -0400
committerJoachim Breitner <mail@joachim-breitner.de>2016-09-15 17:11:36 -0400
commit97b47d277d6b0ced3ce73175f78b23ecff84cfa3 (patch)
tree64067abd89d8b74f066ceb02260cd0a206e8b17e
parenta72d798ce948b054f47d7acd72799384cf06deea (diff)
downloadhaskell-97b47d277d6b0ced3ce73175f78b23ecff84cfa3.tar.gz
Add test case for #7611
basically using the machinery from the test case of #2110.
-rw-r--r--testsuite/tests/simplCore/should_run/T7611.hs29
-rw-r--r--testsuite/tests/simplCore/should_run/T7611.stdout4
-rw-r--r--testsuite/tests/simplCore/should_run/all.T1
3 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_run/T7611.hs b/testsuite/tests/simplCore/should_run/T7611.hs
new file mode 100644
index 0000000000..717a65518a
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T7611.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE MagicHash #-}
+
+import GHC.Exts
+
+newtype Age = Age Int
+
+myMap f [] = []
+myMap f (x:xs) = f x : myMap f xs
+
+{-# RULES "map id2" myMap (\x -> x) = id #-}
+
+mapId = myMap id
+mapIdApp x = myMap id x
+
+mapLamId = myMap (\x -> x)
+mapLamIdApp x = myMap (\x -> x) x
+
+
+same :: a -> a -> IO ()
+same x y = case reallyUnsafePtrEquality# x y of
+ 1# -> putStrLn "yes"
+ _ -> putStrLn "no"
+
+main = do
+ let l = [1,2,3]
+ same (mapId l) l
+ same (mapIdApp l) l
+ same (mapLamId l) l
+ same (mapLamIdApp l) l
diff --git a/testsuite/tests/simplCore/should_run/T7611.stdout b/testsuite/tests/simplCore/should_run/T7611.stdout
new file mode 100644
index 0000000000..4ff957b404
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T7611.stdout
@@ -0,0 +1,4 @@
+yes
+yes
+yes
+yes
diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T
index 7fd181296b..60a279a880 100644
--- a/testsuite/tests/simplCore/should_run/all.T
+++ b/testsuite/tests/simplCore/should_run/all.T
@@ -72,3 +72,4 @@ test('T9390', normal, compile_and_run, [''])
test('T10830', extra_run_opts('+RTS -K100k -RTS'), compile_and_run, [''])
test('T11172', normal, compile_and_run, [''])
test('T11731', normal, compile_and_run, ['-fspec-constr'])
+test('T7611', normal, compile_and_run, [''])