[commit: ghc] master: Extra comments, as per SPJ in #12035. (1f75440)

git at git.haskell.org git at git.haskell.org
Mon Aug 22 20:34:58 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1f75440fc7e4577190d98c0f4643d54d9c934540/ghc

>---------------------------------------------------------------

commit 1f75440fc7e4577190d98c0f4643d54d9c934540
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Mon Aug 22 13:34:43 2016 -0700

    Extra comments, as per SPJ in #12035.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>


>---------------------------------------------------------------

1f75440fc7e4577190d98c0f4643d54d9c934540
 compiler/iface/TcIface.hs | 4 ++++
 compiler/main/GhcMake.hs  | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs
index fa8e26a..5b31b7a 100644
--- a/compiler/iface/TcIface.hs
+++ b/compiler/iface/TcIface.hs
@@ -1421,6 +1421,10 @@ ifKnotErr name env_doc type_env = vcat
 --      * Note [Knot-tying typecheckIface]
 --      * Note [DFun knot-tying]
 --      * Note [hsc_type_env_var hack]
+--
+-- There is also a wiki page on the subject, see:
+--
+--      https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/TyingTheKnot
 
 tcIfaceTyConByName :: IfExtName -> IfL TyCon
 tcIfaceTyConByName name
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index d67a120..bb1c8e3 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -1049,6 +1049,8 @@ parUpsweep_one mod home_mod_map comp_graph_loops lcl_dflags cleanup par_sem
                 let lcl_hsc_env = localize_hsc_env hsc_env
 
                 -- Re-typecheck the loop
+                -- This is necessary to make sure the knot is tied when
+                -- we close a recursive module loop, see bug #12035.
                 type_env_var <- liftIO $ newIORef emptyNameEnv
                 let lcl_hsc_env' = lcl_hsc_env { hsc_type_env_var =
                                     Just (ms_mod lcl_mod, type_env_var) }
@@ -1158,7 +1160,8 @@ upsweep old_hpt stable_mods cleanup sccs = do
         -- Lazily reload the HPT modules participating in the loop.
         -- See Note [Tying the knot]--if we don't throw out the old HPT
         -- and reinitalize the knot-tying process, anything that was forced
-        -- while we were previously typechecking won't get updated.
+        -- while we were previously typechecking won't get updated, this
+        -- was bug #12035.
         hsc_env2 <- liftIO $ reTypecheckLoop hsc_env1 mod done
         setSession hsc_env2
 



More information about the ghc-commits mailing list