[commit: ghc] master: Add test case for #12689 (b5be2ec)
git at git.haskell.org
git at git.haskell.org
Tue Oct 11 20:43:07 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b5be2ec33c395e3e092baf85ebd0696f233ad706/ghc
>---------------------------------------------------------------
commit b5be2ec33c395e3e092baf85ebd0696f233ad706
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Tue Oct 11 16:25:05 2016 -0400
Add test case for #12689
which test a few variants of rules involving constructors, including
nullary constructors, constructors with wrappers, and unsaturated of
constructors.
At the moment, all the rules work as expected, despite GHC’s compile
time warnings when called with -Wall.
>---------------------------------------------------------------
b5be2ec33c395e3e092baf85ebd0696f233ad706
testsuite/tests/simplCore/should_run/T12689.hs | 26 ++++++++++++++++++++++
testsuite/tests/simplCore/should_run/T12689.stdout | 7 ++++++
testsuite/tests/simplCore/should_run/T12689a.hs | 24 ++++++++++++++++++++
.../tests/simplCore/should_run/T12689a.stdout | 5 +++++
testsuite/tests/simplCore/should_run/all.T | 2 ++
5 files changed, 64 insertions(+)
diff --git a/testsuite/tests/simplCore/should_run/T12689.hs b/testsuite/tests/simplCore/should_run/T12689.hs
new file mode 100644
index 0000000..84a5419
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T12689.hs
@@ -0,0 +1,26 @@
+data T1 = MkT1Bad | MkT1Good deriving Show
+data T2 = MkT2Bad Int | MkT2Good Int deriving Show
+data T3 = MkT3Bad {-# UNPACK #-} !Int | MkT3Good {-# UNPACK #-} !Int deriving Show
+data T4 = MkT4Bad Int | MkT4Good Int deriving Show
+data T5 = MkT5Bad {-# UNPACK #-} !Int | MkT5Good {-# UNPACK #-} !Int deriving Show
+
+{-# RULES
+
+"T1" MkT1Bad = MkT1Good
+"T2" forall x. MkT2Bad x = MkT2Good x
+"T3" forall x. MkT3Bad x = MkT3Good x
+"T4" MkT4Bad = MkT4Good
+"T5" MkT5Bad = MkT5Good
+ #-}
+
+app = id
+{-# NOINLINE app #-}
+
+main = do
+ print MkT1Bad
+ print (MkT2Bad 42)
+ print (MkT3Bad 42)
+ print (MkT4Bad 42)
+ print (app MkT4Bad 42)
+ print (MkT5Bad 42)
+ print (app MkT5Bad 42)
diff --git a/testsuite/tests/simplCore/should_run/T12689.stdout b/testsuite/tests/simplCore/should_run/T12689.stdout
new file mode 100644
index 0000000..7e9baf3
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T12689.stdout
@@ -0,0 +1,7 @@
+MkT1Good
+MkT2Good 42
+MkT3Good 42
+MkT4Good 42
+MkT4Good 42
+MkT5Good 42
+MkT5Good 42
diff --git a/testsuite/tests/simplCore/should_run/T12689a.hs b/testsuite/tests/simplCore/should_run/T12689a.hs
new file mode 100644
index 0000000..88fd5ee
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T12689a.hs
@@ -0,0 +1,24 @@
+data T1 = MkT1Bad | MkT1Good deriving Show
+data T2 = MkT2Bad Int | MkT2Good Int deriving Show
+data T3 = MkT3Bad {-# UNPACK #-} !Int | MkT3Good {-# UNPACK #-} !Int deriving Show
+data T4 = MkT4Bad Int | MkT4Good Int deriving Show
+data T5 = MkT5Bad {-# UNPACK #-} !Int | MkT5Good {-# UNPACK #-} !Int deriving Show
+
+{-# RULES
+
+"T1" app MkT1Bad = MkT1Good
+"T2" forall x. app (MkT2Bad x) = MkT2Good x
+"T3" forall x. app (MkT3Bad x) = MkT3Good x
+"T4" app MkT4Bad = MkT4Good
+"T5" app MkT5Bad = MkT5Good
+ #-}
+
+app = id
+{-# NOINLINE app #-}
+
+main = do
+ print (app MkT1Bad)
+ print (app (MkT2Bad 42))
+ print (app (MkT3Bad 42))
+ print (app MkT4Bad 42)
+ print (app MkT5Bad 42)
diff --git a/testsuite/tests/simplCore/should_run/T12689a.stdout b/testsuite/tests/simplCore/should_run/T12689a.stdout
new file mode 100644
index 0000000..c924bde
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T12689a.stdout
@@ -0,0 +1,5 @@
+MkT1Good
+MkT2Good 42
+MkT3Good 42
+MkT4Good 42
+MkT5Good 42
diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T
index 60a279a..1e4e8a7 100644
--- a/testsuite/tests/simplCore/should_run/all.T
+++ b/testsuite/tests/simplCore/should_run/all.T
@@ -73,3 +73,5 @@ 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, [''])
+test('T12689', normal, compile_and_run, [''])
+test('T12689a', normal, compile_and_run, [''])
More information about the ghc-commits
mailing list