[commit: ghc] wip/T9732: Test case for matching on unboxed pattern synonyms (5f22010)

git at git.haskell.org git at git.haskell.org
Sat Nov 1 04:09:50 UTC 2014


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

On branch  : wip/T9732
Link       : http://ghc.haskell.org/trac/ghc/changeset/5f22010b8367f87e6c4a924393a3cdca27219cf9/ghc

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

commit 5f22010b8367f87e6c4a924393a3cdca27219cf9
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Sat Nov 1 12:00:42 2014 +0800

    Test case for matching on unboxed pattern synonyms


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

5f22010b8367f87e6c4a924393a3cdca27219cf9
 testsuite/.gitignore                                |  1 +
 testsuite/tests/patsyn/should_run/all.T             |  1 +
 testsuite/tests/patsyn/should_run/match-unboxed.hs  | 21 +++++++++++++++++++++
 .../should_run/match-unboxed.stdout}                |  2 ++
 4 files changed, 25 insertions(+)

diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index e8b83e8..1893e69 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1084,6 +1084,7 @@ mk/ghcconfig_*_inplace_bin_ghc-stage2.exe.mk
 /tests/patsyn/should_run/ex-prov
 /tests/patsyn/should_run/ex-prov-run
 /tests/patsyn/should_run/match
+/tests/patsyn/should_run/match-unboxed
 /tests/perf/compiler/T1969.comp.stats
 /tests/perf/compiler/T3064.comp.stats
 /tests/perf/compiler/T3294.comp.stats
diff --git a/testsuite/tests/patsyn/should_run/all.T b/testsuite/tests/patsyn/should_run/all.T
index b3c6b74..442dd43 100644
--- a/testsuite/tests/patsyn/should_run/all.T
+++ b/testsuite/tests/patsyn/should_run/all.T
@@ -3,3 +3,4 @@ test('match', normal, compile_and_run, [''])
 test('ex-prov-run', normal, compile_and_run, [''])
 test('bidir-explicit', normal, compile_and_run, [''])
 test('bidir-explicit-scope', normal, compile_and_run, [''])
+test('match-unboxed', normal, compile_and_run, [''])
diff --git a/testsuite/tests/patsyn/should_run/match-unboxed.hs b/testsuite/tests/patsyn/should_run/match-unboxed.hs
new file mode 100644
index 0000000..ec6de0c
--- /dev/null
+++ b/testsuite/tests/patsyn/should_run/match-unboxed.hs
@@ -0,0 +1,21 @@
+{-# LANGUAGE PatternSynonyms, MagicHash #-}
+module Main where
+
+import GHC.Base
+
+pattern P1 <- 0#
+pattern P2 <- 1#
+
+f :: Int# -> Int#
+f P1 = 42#
+f P2 = 44#
+
+g :: Int# -> Int
+g P1 = 42
+g P2 = 44
+
+main = do
+    print $ I# (f 0#)
+    print $ I# (f 1#)
+    print $ g 0#
+    print $ g 1#
diff --git a/testsuite/tests/array/should_run/arr020.stdout b/testsuite/tests/patsyn/should_run/match-unboxed.stdout
similarity index 50%
copy from testsuite/tests/array/should_run/arr020.stdout
copy to testsuite/tests/patsyn/should_run/match-unboxed.stdout
index daaac9e..da4a47e 100644
--- a/testsuite/tests/array/should_run/arr020.stdout
+++ b/testsuite/tests/patsyn/should_run/match-unboxed.stdout
@@ -1,2 +1,4 @@
 42
+44
 42
+44



More information about the ghc-commits mailing list