summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/TyCl.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-02-23 14:14:38 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-28 05:39:41 -0500
commit035d983dfa217bf8784b86e78d6024a3ca1a3f4f (patch)
tree7fb0ee9a8a3cf987aca99cf216d94609221aee58 /compiler/GHC/Tc/TyCl.hs
parent856929a5fa93e9fb13bd9efcb9049054fb1bde72 (diff)
downloadhaskell-035d983dfa217bf8784b86e78d6024a3ca1a3f4f.tar.gz
Fix two places where TcGblEnv was retained
Found with ghc-debug on the ManyConstructors test
Diffstat (limited to 'compiler/GHC/Tc/TyCl.hs')
-rw-r--r--compiler/GHC/Tc/TyCl.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/Tc/TyCl.hs b/compiler/GHC/Tc/TyCl.hs
index 6f7a7c548c..45d38fd87d 100644
--- a/compiler/GHC/Tc/TyCl.hs
+++ b/compiler/GHC/Tc/TyCl.hs
@@ -239,7 +239,9 @@ tcTyClDecls tyclds kisig_env role_annots
-- loops yet and could fall into a black hole.
; fixM $ \ ~(rec_tyclss, _) -> do
{ tcg_env <- getGblEnv
- ; let roles = inferRoles (tcg_src tcg_env) role_annots rec_tyclss
+ -- Forced so we don't retain a reference to the TcGblEnv
+ ; let !src = tcg_src tcg_env
+ roles = inferRoles src role_annots rec_tyclss
-- Populate environment with knot-tied ATyCon for TyCons
-- NB: if the decls mention any ill-staged data cons