summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/simplCore/should_run/T3972.hs
blob: 324ddd4f9a49ef12993e23f5ea048cfa7f7db0f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

module Main (main) where

import T3972A (Expr(E10), Token, spanning, getSpan)

import Control.Monad
import System.Exit
import System.IO

main :: IO ()
main = do h <- openFile "T3972.o" ReadMode
          s <- hFileSize h
          hClose h
          -- size is just under 8k on amd64/Linux in 6.13, but was
          -- around 3.5M in 6.12. Let's try >20k as the test for
          -- having regressed.
          when (s > 20000) $ do
              hPutStrLn stderr ("T3972.o is too big! " ++ show s)
              exitFailure

makeTupleOrExpr :: [Expr] -> Maybe Token -> Expr
makeTupleOrExpr [e] Nothing = e
makeTupleOrExpr es@(_:_) (Just t) = E10 (spanning es t)
makeTupleOrExpr es@(_:_) Nothing  = E10 (getSpan es)