Richards optCoercion improvement made test cases fail the nice way
[ghc.git] / testsuite / tests / eyeball / dmd-on-polymorphic-floatouts.hs
1 {-# OPTIONS_GHC -fglasgow-exts -O -ddump-prep #-}
2 module Max(result) where
3
4 foo ys = foldr (\x xs -> x : reverse xs) [] ys
5
6 result xs =
7 let stuff = [1, 1, 1, 1, 1, 1]
8 in foo (reverse stuff)
9
10 -- What used to happen is that foldr got expanded by main simplification
11 -- and the resulting "go" function got floated out but because we manufactured
12 -- a new binder for it in newPolyBndrs we would lose its demand signature!
13 -- This means that the later application of it in result did not use call by value :-(
14
15 -- Eyeball test:
16 -- Ensure that Max.poly_go has a demand signature
17 -- Ensure that we use call by value to call Max.poly_go in result
18 -- i.e. the call to Max.poly_go inside Max.result looks like this:
19 --
20 -- case GHC.List.poly_rev @ t1_a6x sat_seb (GHC.Base.[] @ t1_a6x)
21 -- of sat_sed { __DEFAULT ->
22 -- Max.poly_go @ t1_a6x sat_sed
23 -- } } in