diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-12-20 12:41:14 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-12-21 13:00:14 +0000 |
commit | 66ce7de15dbc594e6890b5651dba3aa669c8d5fc (patch) | |
tree | ff8fd5801c91a5733aa0b8e2ddd02d7df1e0030a | |
parent | 28188e06b4953f589c7cd442ae14787bc74cabf8 (diff) | |
download | haskell-66ce7de15dbc594e6890b5651dba3aa669c8d5fc.tar.gz |
Tiny refactor to tcExtendRecEnv
In tcExtendRecEnv, there is no need to us setGlobalTypeEnv
(which side-effects the tcg_type_env_var). tcExtendRecEnv
is used only when kind-checking a group of type/class decls
and no knot-tying via tcg_type_env_var is needed.
There is no change in functionality.
-rw-r--r-- | compiler/typecheck/TcEnv.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/typecheck/TcEnv.hs b/compiler/typecheck/TcEnv.hs index d32272bfc5..7337345ed0 100644 --- a/compiler/typecheck/TcEnv.hs +++ b/compiler/typecheck/TcEnv.hs @@ -378,8 +378,13 @@ tcExtendRecEnv :: [(Name,TyThing)] -> TcM r -> TcM r -- Just like tcExtendGlobalEnv, except the argument is a list of pairs tcExtendRecEnv gbl_stuff thing_inside = do { tcg_env <- getGblEnv - ; let ge' = extendNameEnvList (tcg_type_env tcg_env) gbl_stuff - ; tcg_env' <- setGlobalTypeEnv tcg_env ge' + ; let ge' = extendNameEnvList (tcg_type_env tcg_env) gbl_stuff + tcg_env' = tcg_env { tcg_type_env = ge' } + -- No need for setGlobalTypeEnv (which side-effects the + -- tcg_type_env_var); tcExtendRecEnv is used just + -- when kind-check a group of type/class decls. It would + -- in any case be wrong for an interface-file decl to end up + -- with a TcTyCon in it! ; setGblEnv tcg_env' thing_inside } {- |