[commit: ghc] master: Add test case for #7611 (97b47d2)

git at git.haskell.org git at git.haskell.org
Thu Sep 15 21:12:34 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/97b47d277d6b0ced3ce73175f78b23ecff84cfa3/ghc

>---------------------------------------------------------------

commit 97b47d277d6b0ced3ce73175f78b23ecff84cfa3
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Sep 15 17:06:16 2016 -0400

    Add test case for #7611
    
    basically using the machinery from the test case of #2110.


>---------------------------------------------------------------

97b47d277d6b0ced3ce73175f78b23ecff84cfa3
 testsuite/tests/simplCore/should_run/T7611.hs      | 29 ++++++++++++++++++++++
 .../should_run/{AmapCoerce.stdout => T7611.stdout} |  1 +
 testsuite/tests/simplCore/should_run/all.T         |  1 +
 3 files changed, 31 insertions(+)

diff --git a/testsuite/tests/simplCore/should_run/T7611.hs b/testsuite/tests/simplCore/should_run/T7611.hs
new file mode 100644
index 0000000..717a655
--- /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/AmapCoerce.stdout b/testsuite/tests/simplCore/should_run/T7611.stdout
similarity index 75%
copy from testsuite/tests/simplCore/should_run/AmapCoerce.stdout
copy to testsuite/tests/simplCore/should_run/T7611.stdout
index 55f7ebb..4ff957b 100644
--- a/testsuite/tests/simplCore/should_run/AmapCoerce.stdout
+++ b/testsuite/tests/simplCore/should_run/T7611.stdout
@@ -1,3 +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 7fd1812..60a279a 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, [''])



More information about the ghc-commits mailing list