summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Bracker <jan.bracker@googlemail.com>2015-02-23 03:40:15 -0600
committerAustin Seipp <austin@well-typed.com>2015-02-23 03:40:16 -0600
commitfd581a7300abede9a070cb6e9b835b2e18f68b0b (patch)
tree1c9ffbb0018ebc2229cd1af4d7cd7e44caf1469c
parentbbb57a6b3a31c22a5a24fa4b92abbe13a6736ad8 (diff)
downloadhaskell-fd581a7300abede9a070cb6e9b835b2e18f68b0b.tar.gz
Fix for ticket #10078: ensure that tcPluginStop is called even in case of type errors
Summary: Remove unused variable that appeared through the fix for ticket #10078 Merge branch 'master' of git://git.haskell.org/ghc Added comment with bug ID. Reviewers: adamgundry, gridaphobe, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D667 GHC Trac Issues: #10078
-rw-r--r--compiler/typecheck/TcRnDriver.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index 85d5a2ade1..2ac45fc224 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/typecheck/TcRnDriver.hs
@@ -2121,9 +2121,14 @@ withTcPlugins hsc_env m =
case plugins of
[] -> m -- Common fast case
_ -> do (solvers,stops) <- unzip `fmap` mapM startPlugin plugins
- res <- updGblEnv (\e -> e { tcg_tc_plugins = solvers }) m
+ -- This ensures that tcPluginStop is called even if a type
+ -- error occurs during compilation (Fix of #10078)
+ eitherRes <- tryM $ do
+ updGblEnv (\e -> e { tcg_tc_plugins = solvers }) m
mapM_ runTcPluginM stops
- return res
+ case eitherRes of
+ Left _ -> failM
+ Right res -> return res
where
startPlugin (TcPlugin start solve stop) =
do s <- runTcPluginM start