Commit 40db99a7 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Test Trac #8639

parent f54fc09b
...@@ -9,6 +9,10 @@ T6145: clean ...@@ -9,6 +9,10 @@ T6145: clean
'$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T6145 '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T6145
./T6145 "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" ./T6145 "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`"
T8639_api: clean
'$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T8639_api
./T8639_api "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`"
.PHONY: clean T6145 .PHONY: clean T6145
module Main where
import GHC
import GhcMonad
import Outputable
import System.IO
import System.Environment( getArgs )
= do { [libdir] <- getArgs
; runGhc (Just libdir) $ do
flags <- getSessionDynFlags
setSessionDynFlags (flags{ hscTarget = HscInterpreted, ghcLink = LinkInMemory})
target <- guessTarget "T8639_api_a.hs" Nothing
setTargets [target]
load LoadAllTargets
imps <- mapM parseImportDecl ["import Prelude", "import T8639_api_a"]
setContext (map IIDecl imps)
-- With the next line, you get an "Not in scope" exception.
-- If you comment out this runStmt, it runs without error and prints the type.
runStmt "putStrLn (show 3)" RunToCompletion
ty <- exprType ""
liftIO (putStrLn (showPpr flags ty))
; hFlush stdout }
module T8639_api_a where
it = True
test('ghcApi', normal, compile_and_run, ['-package ghc'])
test('T6145', when(fast(), skip), test('T6145', when(fast(), skip),
run_command, run_command,
['$MAKE -s --no-print-directory T6145']) ['$MAKE -s --no-print-directory T6145'])
test('ghcApi', normal, compile_and_run, ['-package ghc']) test('T8639_api', when(fast(), skip),
['$MAKE -s --no-print-directory T8639_api'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment