diff options
author | Matthew Pickering <matthew.pickering@tweag.io> | 2018-07-12 10:12:23 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-07-12 15:04:20 -0400 |
commit | 1a79270c72cfcd98d683cfe7b2c777d8dd353b78 (patch) | |
tree | de1bc6a2a1484cf9d7ad4f1b9580994abc263ac6 /testsuite | |
parent | 305da44c86950855e2a86dee446fda2694f2f0ac (diff) | |
download | haskell-1a79270c72cfcd98d683cfe7b2c777d8dd353b78.tar.gz |
Run the renamed source plugin after each HsGroup
This allows modification of each `HsGroup` after it has been renamed.
The old behaviour of keeping the renamed source until later can be
recovered if desired by using the `keepRenamedSource` plugin but it
shouldn't really be necessary as it can be inspected in the `TcGblEnv`.
Reviewers: nboldi, bgamari, alpmestan
Reviewed By: nboldi, alpmestan
Subscribers: alpmestan, rwbarton, thomie, carter
GHC Trac Issues: #15315
Differential Revision: https://phabricator.haskell.org/D4947
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/plugins/plugins09.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/plugins/plugins11.stdout | 2 | ||||
-rw-r--r-- | testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs | 14 |
3 files changed, 9 insertions, 9 deletions
diff --git a/testsuite/tests/plugins/plugins09.stdout b/testsuite/tests/plugins/plugins09.stdout index 5e212f3e2f..885850e598 100644 --- a/testsuite/tests/plugins/plugins09.stdout +++ b/testsuite/tests/plugins/plugins09.stdout @@ -2,8 +2,8 @@ parsePlugin(a,b) interfacePlugin: Prelude interfacePlugin: GHC.Float interfacePlugin: GHC.Base -interfacePlugin: GHC.Types typeCheckPlugin (rn) +interfacePlugin: GHC.Types typeCheckPlugin (tc) interfacePlugin: GHC.Integer.Type interfacePlugin: GHC.Natural diff --git a/testsuite/tests/plugins/plugins11.stdout b/testsuite/tests/plugins/plugins11.stdout index ff31aa3c8c..8e0dca4335 100644 --- a/testsuite/tests/plugins/plugins11.stdout +++ b/testsuite/tests/plugins/plugins11.stdout @@ -2,8 +2,8 @@ parsePlugin() interfacePlugin: Prelude interfacePlugin: GHC.Float interfacePlugin: GHC.Base -interfacePlugin: GHC.Types typeCheckPlugin (rn) +interfacePlugin: GHC.Types typeCheckPlugin (tc) interfacePlugin: GHC.Integer.Type interfacePlugin: GHC.Natural diff --git a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs index 85fc870604..b9bdaeb37a 100644 --- a/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs +++ b/testsuite/tests/plugins/simple-plugin/Simple/SourcePlugin.hs @@ -19,7 +19,7 @@ plugin = defaultPlugin { parsedResultAction = parsedPlugin , typeCheckResultAction = typecheckPlugin , spliceRunAction = metaPlugin' , interfaceLoadAction = interfaceLoadPlugin' - , renamedResultAction = Just renamedAction + , renamedResultAction = renamedAction } parsedPlugin :: [CommandLineOption] -> ModSummary -> HsParsedModule @@ -28,12 +28,12 @@ parsedPlugin opts _ pm = do liftIO $ putStrLn $ "parsePlugin(" ++ intercalate "," opts ++ ")" return pm -renamedAction :: [CommandLineOption] -> ModSummary - -> ( HsGroup GhcRn, [LImportDecl GhcRn] - , Maybe [(LIE GhcRn, Avails)], Maybe LHsDocString ) - -> TcM () -renamedAction _ _ ( gr, _, _, _ ) - = liftIO $ putStrLn "typeCheckPlugin (rn)" +renamedAction :: [CommandLineOption] + -> TcGblEnv -> HsGroup GhcRn + -> TcM (TcGblEnv, HsGroup GhcRn) +renamedAction _ env grp + = do liftIO $ putStrLn "typeCheckPlugin (rn)" + return (env, grp) typecheckPlugin :: [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv typecheckPlugin _ _ tc |