summaryrefslogtreecommitdiff
path: root/testsuite/tests/eyeball/dmd-on-polymorphic-floatouts.hs
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/eyeball/dmd-on-polymorphic-floatouts.hs
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/eyeball/dmd-on-polymorphic-floatouts.hs')
-rw-r--r--testsuite/tests/eyeball/dmd-on-polymorphic-floatouts.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/eyeball/dmd-on-polymorphic-floatouts.hs b/testsuite/tests/eyeball/dmd-on-polymorphic-floatouts.hs
new file mode 100644
index 0000000000..fa411e23f2
--- /dev/null
+++ b/testsuite/tests/eyeball/dmd-on-polymorphic-floatouts.hs
@@ -0,0 +1,23 @@
+{-# OPTIONS_GHC -fglasgow-exts -O -ddump-prep #-}
+module Max(result) where
+
+foo ys = foldr (\x xs -> x : reverse xs) [] ys
+
+result xs =
+ let stuff = [1, 1, 1, 1, 1, 1]
+ in foo (reverse stuff)
+
+-- What used to happen is that foldr got expanded by main simplification
+-- and the resulting "go" function got floated out but because we manufactured
+-- a new binder for it in newPolyBndrs we would lose its demand signature!
+-- This means that the later application of it in result did not use call by value :-(
+
+-- Eyeball test:
+-- Ensure that Max.poly_go has a demand signature
+-- Ensure that we use call by value to call Max.poly_go in result
+-- i.e. the call to Max.poly_go inside Max.result looks like this:
+--
+-- case GHC.List.poly_rev @ t1_a6x sat_seb (GHC.Base.[] @ t1_a6x)
+-- of sat_sed { __DEFAULT ->
+-- Max.poly_go @ t1_a6x sat_sed
+-- } } in