diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-01-18 16:36:45 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-03 14:44:17 -0500 |
commit | 1accdcff0cadc42f9d0192408e60f66bf33b464e (patch) | |
tree | 61c8481b34704433e558edebf96ede077a374ef1 /testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs | |
parent | 00180cdfdf8d6d21df8a7cd9c7942e9a14ac44a3 (diff) | |
download | haskell-1accdcff0cadc42f9d0192408e60f66bf33b464e.tar.gz |
Add flushes to plugin tests which print to stdout
Due to #20791 you need to explicitly flush as otherwise the output from
these tests doesn't make it to stdout.
Diffstat (limited to 'testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs')
-rw-r--r-- | testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs index 0a9ef301d6..bb0458bf3e 100644 --- a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs +++ b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs @@ -15,6 +15,7 @@ import GHC.Utils.Outputable import GHC.Hs.ImpExp import GHC.Hs.Decls import GHC.Hs.Doc +import System.IO plugin :: Plugin plugin = defaultPlugin { parsedResultAction = parsedPlugin @@ -28,6 +29,8 @@ parsedPlugin :: [CommandLineOption] -> ModSummary -> HsParsedModule -> Hsc HsParsedModule parsedPlugin opts _ pm = do liftIO $ putStrLn $ "parsePlugin(" ++ intercalate "," opts ++ ")" + -- TODO: Remove #20791 + liftIO $ hFlush stdout return pm renamedAction :: [CommandLineOption] @@ -35,17 +38,24 @@ renamedAction :: [CommandLineOption] -> TcM (TcGblEnv, HsGroup GhcRn) renamedAction _ env grp = do liftIO $ putStrLn "typeCheckPlugin (rn)" + -- TODO: Remove #20791 + liftIO $ hFlush stdout return (env, grp) typecheckPlugin :: [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv typecheckPlugin _ _ tc = do liftIO $ putStrLn "typeCheckPlugin (tc)" + -- TODO: Remove #20791 + liftIO $ hFlush stdout return tc metaPlugin' :: [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc) metaPlugin' _ meta = do dflags <- getDynFlags liftIO $ putStrLn $ "metaPlugin: " ++ (showSDoc dflags $ ppr meta) + -- TODO: Remove #20791 + liftIO $ hFlush stdout + return meta interfaceLoadPlugin' :: [CommandLineOption] -> ModIface -> IfM lcl ModIface @@ -53,4 +63,6 @@ interfaceLoadPlugin' _ iface = do dflags <- getDynFlags liftIO $ putStrLn $ "interfacePlugin: " ++ (showSDoc dflags $ ppr $ mi_module iface) + -- TODO: Remove #20791 + liftIO $ hFlush stdout return iface |