[project @ 2000-06-26 16:09:40 by simonpj]
authorsimonpj <unknown>
Mon, 26 Jun 2000 16:09:40 +0000 (16:09 +0000)
committersimonpj <unknown>
Mon, 26 Jun 2000 16:09:40 +0000 (16:09 +0000)
Add test for filterFB

ghc/tests/simplCore/should_run/Makefile [new file with mode: 0644]
ghc/tests/simplCore/should_run/simplrun001.hs [new file with mode: 0644]
ghc/tests/simplCore/should_run/simplrun001.stderr [new file with mode: 0644]
ghc/tests/simplCore/should_run/simplrun001.stdout [new file with mode: 0644]

diff --git a/ghc/tests/simplCore/should_run/Makefile b/ghc/tests/simplCore/should_run/Makefile
new file mode 100644 (file)
index 0000000..7ec3806
--- /dev/null
@@ -0,0 +1,9 @@
+TOP = ../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/should_run.mk
+
+SRC_HC_OPTS += -dcore-lint
+
+include $(TOP)/mk/target.mk
+
+
diff --git a/ghc/tests/simplCore/should_run/simplrun001.hs b/ghc/tests/simplCore/should_run/simplrun001.hs
new file mode 100644 (file)
index 0000000..f0b02c1
--- /dev/null
@@ -0,0 +1,16 @@
+{-# OPTIONS -O #-}
+
+-- !!! Test filter fusion
+
+-- In GHC 4.06, the filterFB rule was back to front, which
+-- made this program hit the "error foo" case instead of
+-- working fine.
+
+
+module Main where
+
+main :: IO ()
+main = print (length (filter (not . foo)
+                             (filter (const False) [Nothing])))
+  where foo (Just x) = x
+        foo _        = error "foo"
diff --git a/ghc/tests/simplCore/should_run/simplrun001.stderr b/ghc/tests/simplCore/should_run/simplrun001.stderr
new file mode 100644 (file)
index 0000000..317bd0d
--- /dev/null
@@ -0,0 +1,2 @@
+
+Fail: foo
diff --git a/ghc/tests/simplCore/should_run/simplrun001.stdout b/ghc/tests/simplCore/should_run/simplrun001.stdout
new file mode 100644 (file)
index 0000000..573541a
--- /dev/null
@@ -0,0 +1 @@
+0