From f1934472abf6ad317f1217a39e695600c0e82cf5 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Tue, 11 May 2010 07:50:26 +0000 Subject: [PATCH] Fix Trac #4003: fix the knot-tying in checkHiBootIface I had incorrectly "optimised" checkHiBootIface so that it forgot to update the "knot-tied" type environment. This patch fixes the HEAD --- compiler/ghc.mk | 7 ------- compiler/typecheck/TcRnDriver.lhs | 18 +++++++++++------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 3b12f7c..827ffb4 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -480,13 +480,6 @@ $(eval $(call compiler-hs-dependency,PrimOp,$(PRIMOP_BITS))) compiler/prelude/PrimOps_HC_OPTS += -fforce-recomp compiler/main/Constants_HC_OPTS += -fforce-recomp -# Workaround for #4003 in GHC 6.12.2. It didn't happen in 6.12.1, and -# will be fixed in 6.12.3. Unfortunately we don't have a way to do -# this for just stage1 in the build system. -ifeq "$(GhcVersion)" "6.12.2" -compiler/hsSyn/HsLit_HC_OPTS += -fomit-interface-pragmas -endif - # Note [munge-stage1-package-config] # Strip the date/patchlevel from the version of stage1. See Note # [fiddle-stage1-version] above. diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs index 262bd73..649807e 100644 --- a/compiler/typecheck/TcRnDriver.lhs +++ b/compiler/typecheck/TcRnDriver.lhs @@ -566,15 +566,19 @@ checkHiBootIface -- Check instance declarations ; mb_dfun_prs <- mapM check_inst boot_insts - ; let tcg_env' = tcg_env { tcg_binds = binds `unionBags` dfun_binds, - tcg_type_env = extendTypeEnvWithIds local_type_env boot_dfuns } - dfun_prs = catMaybes mb_dfun_prs - boot_dfuns = map fst dfun_prs - dfun_binds = listToBag [ mkVarBind boot_dfun (nlHsVar dfun) - | (boot_dfun, dfun) <- dfun_prs ] + ; let dfun_prs = catMaybes mb_dfun_prs + boot_dfuns = map fst dfun_prs + dfun_binds = listToBag [ mkVarBind boot_dfun (nlHsVar dfun) + | (boot_dfun, dfun) <- dfun_prs ] + type_env' = extendTypeEnvWithIds local_type_env boot_dfuns + tcg_env' = tcg_env { tcg_binds = binds `unionBags` dfun_binds } ; failIfErrsM - ; return tcg_env' } + ; setGlobalTypeEnv tcg_env' type_env' } + -- Update the global type env *including* the knot-tied one + -- so that if the source module reads in an interface unfolding + -- mentioning one of the dfuns from the boot module, then it + -- can "see" that boot dfun. See Trac #4003 where check_export boot_avail -- boot_avail is exported by the boot iface | name `elem` dfun_names = return () -- 1.7.10.4