summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
diff options
context:
space:
mode:
authorJakob Brünker <jakob.bruenker@gmail.com>2022-03-18 17:56:07 +0100
committerJakob Brünker <jakob.bruenker@gmail.com>2022-03-24 18:00:07 +0100
commitb05ffcbf6c46f053b5c707fee6579bee08449c77 (patch)
tree8eb57106869c745e13a4aa4de4a97d34436796f8 /testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
parented04aed2b2d87d605c1cd13161bd3511e43c9452 (diff)
downloadhaskell-wip/T20803.tar.gz
Give parsing plugins access to errorswip/T20803
Previously, when the parser produced non-fatal errors (i.e. it produced errors but the 'PState' is 'POk'), compilation would be aborted before the 'parsedResultAction' of any plugin was invoked. This commit changes that, so that such that 'parsedResultAction' gets collections of warnings and errors as argument, and must return them after potentially modifying them. Closes #20803
Diffstat (limited to 'testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs')
-rw-r--r--testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
index dfbed9e490..d638bd6a48 100644
--- a/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
+++ b/testsuite/tests/plugins/simple-plugin/Simple/RemovePlugin.hs
@@ -28,10 +28,11 @@ plugin = defaultPlugin { parsedResultAction = parsedPlugin
}
parsedPlugin :: [CommandLineOption] -> ModSummary -> HsParsedModule
- -> Hsc HsParsedModule
-parsedPlugin [name, "parse"] _ pm
- = return $ pm { hpm_module = removeParsedBinding name (hpm_module pm) }
-parsedPlugin _ _ pm = return pm
+ -> (Messages PsWarning, Messages PsError)
+ -> Hsc (HsParsedModule, (Messages PsWarning, Messages PsError))
+parsedPlugin [name, "parse"] _ pm msgs
+ = return (pm { hpm_module = removeParsedBinding name (hpm_module pm) }, msgs)
+parsedPlugin _ _ pm msgs = return (pm, msgs)
removeParsedBinding :: String -> Located HsModule
-> Located HsModule