summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexbiehl <alexbiehl@gmail.com>2021-01-08 10:43:39 +0100
committerBen Gamari <ben@smart-cactus.org>2021-04-07 18:37:46 -0400
commit8d4fd516d4069e8c9fe500b04e76e3b21096b29b (patch)
treeec1828cc92148dab0cd7ec4434e93fbe7bbcf01e
parentb0202fe98dd168c09e4d736c411ae7452cee1fbc (diff)
downloadhaskell-8d4fd516d4069e8c9fe500b04e76e3b21096b29b.tar.gz
Ensure tcg_env is up-to-date when running typechecker plugins
(cherry picked from commit b068103d60fd67708916ca5e778f5f833fcc34da)
-rw-r--r--compiler/GHC/Tc/Module.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs
index 9f8c6a53da..ecb2e4241e 100644
--- a/compiler/GHC/Tc/Module.hs
+++ b/compiler/GHC/Tc/Module.hs
@@ -305,10 +305,14 @@ tcRnModuleTcRnM hsc_env mod_sum
reportUnusedNames tcg_env hsc_src
; -- add extra source files to tcg_dependent_files
addDependentFiles src_files
- ; tcg_env <- runTypecheckerPlugin mod_sum hsc_env tcg_env
- ; -- Dump output and return
- tcDump tcg_env
- ; return tcg_env }
+ -- Ensure plugins run with the same tcg_env that we pass in
+ ; setGblEnv tcg_env
+ $ do { tcg_env <- runTypecheckerPlugin mod_sum hsc_env tcg_env
+ ; -- Dump output and return
+ tcDump tcg_env
+ ; return tcg_env
+ }
+ }
}
}
}