From: simonpj Date: Mon, 20 Aug 2001 08:17:38 +0000 (+0000) Subject: [project @ 2001-08-20 08:17:38 by simonpj] X-Git-Tag: Approximately_9120_patches~1184 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=95c1df879b96a4a87076672207d47a8e0f3a98f4;p=ghc-hetmet.git [project @ 2001-08-20 08:17:38 by simonpj] Fix (another) "missing instnace" bug in the renamer. This one interacted with the interactive loop in ghci. --- diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs index 1a75cb3..53ed3a2 100644 --- a/ghc/compiler/rename/Rename.lhs +++ b/ghc/compiler/rename/Rename.lhs @@ -126,7 +126,19 @@ renameStmt dflags hit hst pcs scope_module this_module local_env stmt doDump dflags [] stmt [] `thenRn_` returnRn (print_unqual, Nothing) else - slurpImplicitDecls fvs local_env `thenRn` \ decls -> + -- Add implicit free vars, and close decls + getImplicitStmtFVs `thenRn` \ implicit_fvs -> + slurpImpDecls (fvs `plusFV` implicit_fvs) `thenRn` \ decls -> + -- NB: an earlier version deleted (rdrEnvElts local_env) from + -- the fvs. But (a) that isn't necessary, because previously + -- bound things in the local_env will be in the TypeEnv, and + -- the renamer doesn't re-slurp such things, and + -- (b) it's WRONG to delete them. Consider in GHCi: + -- Mod> let x = e :: T + -- Mod> let y = x + 3 + -- We need to pass 'x' among the fvs to slurpImpDecls, so that + -- the latter can see that T is a gate, and hence import the Num T + -- instance decl. (See the InTypEnv case in RnIfaces.slurpSourceRefs doDump dflags binders stmt decls `thenRn_` returnRn (print_unqual, Just (binders, (stmt, decls))) @@ -171,7 +183,8 @@ renameRdrName dflags hit hst pcs scope_module this_module local_env rdr_names = returnRn (print_unqual, Nothing) else - slurpImplicitDecls (mkNameSet ok_names) local_env `thenRn` \ decls -> + slurpImpDecls (mkNameSet ok_names) `thenRn` \ decls -> + doDump dflags ok_names decls `thenRn_` returnRn (print_unqual, Just (ok_names, decls)) where @@ -197,15 +210,6 @@ loadContextModule scope_module thing_inside returnRn (print_unqual, Nothing) else thing_inside (rdr_env, print_unqual) - --- Add implicit free vars, and close decls -slurpImplicitDecls fvs local_env - = getImplicitStmtFVs `thenRn` \ implicit_fvs -> - let - filtered_fvs = fvs `delListFromNameSet` rdrEnvElts local_env - source_fvs = implicit_fvs `plusFV` filtered_fvs - in - slurpImpDecls source_fvs \end{code} %*********************************************************