compiler: make sure we reject -O + HscInterpreted
[ghc.git] / testsuite / tests / ghc-api / T10052 / T10052.hs
1 {-# LANGUAGE RecordWildCards #-}
2 {-# OPTIONS_GHC -Wall #-}
3 module Main where
4
5 import System.Environment
6 import GHC
7
8 main :: IO ()
9 main = do
10 flags <- getArgs
11 runGhc' flags $ do
12 setTargets [Target (TargetFile "T10052-input.hs" Nothing) True Nothing]
13 _success <- load LoadAllTargets
14 return ()
15
16 runGhc' :: [String] -> Ghc a -> IO a
17 runGhc' args act = do
18 let libdir = head args
19 flags = tail args
20 (dynFlags, _warns) <- parseStaticFlags (map noLoc flags)
21 runGhc (Just libdir) $ do
22 dflags0 <- getSessionDynFlags
23 (dflags1, _leftover, _warns) <- parseDynamicFlags dflags0 dynFlags
24 let dflags2 = dflags1 {
25 hscTarget = HscInterpreted
26 , ghcLink = LinkInMemory
27 , verbosity = 1
28 }
29 _newPkgs <- setSessionDynFlags dflags2
30 act