diff options
Diffstat (limited to 'testsuite/tests/unboxedsums/unboxedsums7.hs')
-rw-r--r-- | testsuite/tests/unboxedsums/unboxedsums7.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testsuite/tests/unboxedsums/unboxedsums7.hs b/testsuite/tests/unboxedsums/unboxedsums7.hs new file mode 100644 index 0000000000..d64dabb13a --- /dev/null +++ b/testsuite/tests/unboxedsums/unboxedsums7.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE UnboxedSums, UnboxedTuples, MagicHash #-} + +module Main where + +import GHC.Prim +import GHC.Types + +type Either1 a b c = (# a | (# b, c #) #) + +-- The bug disappears when this is inlined +{-# NOINLINE showEither1 #-} + +showEither1 :: Either1 String Int Bool -> String +showEither1 (# left | #) = "Left " ++ show left +showEither1 (# | (# right1, right2 #) #) = "Right " ++ show right1 ++ " " ++ show right2 + +main :: IO () +main = do + -- This line used to print "Right -4611686018427359531 False" + putStrLn (showEither1 e1_2) + where + -- boxed types only + e1_2 :: Either1 String Int Bool + e1_2 = (# | (# 10, True #) #) |