[commit: ghc] wip/T9732: Test cases for bidirectional, unboxed pattern synonyms (caf582d)

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


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

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

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

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

    Test cases for bidirectional, unboxed pattern synonyms


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

caf582d1a41c0c0be32ff64cee6d6ca449440e30
 testsuite/.gitignore                                             | 1 +
 testsuite/tests/patsyn/should_fail/all.T                         | 1 +
 .../should_fail/{unboxed-bind.hs => unboxed-wrapper-naked.hs}    | 6 ++----
 testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.stderr  | 3 +++
 testsuite/tests/patsyn/should_run/all.T                          | 1 +
 testsuite/tests/patsyn/should_run/unboxed-wrapper.hs             | 9 +++++++++
 .../cgrun002.stdout => patsyn/should_run/unboxed-wrapper.stdout} | 0
 7 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 1893e69..0d12434 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -1085,6 +1085,7 @@ mk/ghcconfig_*_inplace_bin_ghc-stage2.exe.mk
 /tests/patsyn/should_run/ex-prov-run
 /tests/patsyn/should_run/match
 /tests/patsyn/should_run/match-unboxed
+/tests/patsyn/should_run/unboxed-wrapper
 /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_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T
index 808e261..5a26df5 100644
--- a/testsuite/tests/patsyn/should_fail/all.T
+++ b/testsuite/tests/patsyn/should_fail/all.T
@@ -7,3 +7,4 @@ test('as-pattern', normal, compile_fail, [''])
 test('T9161-1', normal, compile_fail, [''])
 test('T9161-2', normal, compile_fail, [''])
 test('unboxed-bind', normal, compile_fail, [''])
+test('unboxed-wrapper-naked', normal, compile_fail, [''])
diff --git a/testsuite/tests/patsyn/should_fail/unboxed-bind.hs b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.hs
similarity index 52%
copy from testsuite/tests/patsyn/should_fail/unboxed-bind.hs
copy to testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.hs
index ef1b070..6e7cc94 100644
--- a/testsuite/tests/patsyn/should_fail/unboxed-bind.hs
+++ b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.hs
@@ -3,8 +3,6 @@ module ShouldFail where
 
 import GHC.Base
 
-data Foo = MkFoo Int# Int#
+pattern P1 = 42#
 
-pattern P x = MkFoo 0# x
-
-f x = let P arg = x in arg
+x = P1
diff --git a/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.stderr b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.stderr
new file mode 100644
index 0000000..e8d8950
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/unboxed-wrapper-naked.stderr
@@ -0,0 +1,3 @@
+
+unboxed-wrapper-naked.hs:8:1:
+    Top-level bindings for unlifted types aren't allowed: x = P1
diff --git a/testsuite/tests/patsyn/should_run/all.T b/testsuite/tests/patsyn/should_run/all.T
index 442dd43..b557b3c 100644
--- a/testsuite/tests/patsyn/should_run/all.T
+++ b/testsuite/tests/patsyn/should_run/all.T
@@ -4,3 +4,4 @@ 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, [''])
+test('unboxed-wrapper', normal, compile_and_run, [''])
diff --git a/testsuite/tests/patsyn/should_run/unboxed-wrapper.hs b/testsuite/tests/patsyn/should_run/unboxed-wrapper.hs
new file mode 100644
index 0000000..367c8cc
--- /dev/null
+++ b/testsuite/tests/patsyn/should_run/unboxed-wrapper.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE PatternSynonyms, MagicHash #-}
+module Main where
+
+import GHC.Base
+
+pattern P1 = 42#
+
+main = do
+    print $ I# P1
diff --git a/testsuite/tests/codeGen/should_run/cgrun002.stdout b/testsuite/tests/patsyn/should_run/unboxed-wrapper.stdout
similarity index 100%
copy from testsuite/tests/codeGen/should_run/cgrun002.stdout
copy to testsuite/tests/patsyn/should_run/unboxed-wrapper.stdout



More information about the ghc-commits mailing list