summaryrefslogtreecommitdiff
path: root/ghc/compiler/rename/Rename.lhs
diff options
context:
space:
mode:
authorsimonpj <unknown>2000-11-20 14:48:59 +0000
committersimonpj <unknown>2000-11-20 14:48:59 +0000
commitc271b64780a6504e7ccd4cc422dfc90678ea966f (patch)
treee75f7b6abaa149d0fb1ce80e0bbb891ea355f806 /ghc/compiler/rename/Rename.lhs
parent9a094a5c6dd79e33224aa7eff496d7b9aa180c39 (diff)
downloadhaskell-c271b64780a6504e7ccd4cc422dfc90678ea966f.tar.gz
[project @ 2000-11-20 14:48:52 by simonpj]
When renaming, typechecking an expression from the user interface, we may suck in declarations from interface files (e.g. the Prelude). This commit takes account of that. To do so, I did some significant restructuring in TcModule, with consequential changes and tidy ups elsewhere in the type checker. I think there should be fewer lines in total than before.
Diffstat (limited to 'ghc/compiler/rename/Rename.lhs')
-rw-r--r--ghc/compiler/rename/Rename.lhs14
1 files changed, 6 insertions, 8 deletions
diff --git a/ghc/compiler/rename/Rename.lhs b/ghc/compiler/rename/Rename.lhs
index afc43b6547..fefa9dc0b5 100644
--- a/ghc/compiler/rename/Rename.lhs
+++ b/ghc/compiler/rename/Rename.lhs
@@ -101,7 +101,7 @@ renameExpr :: DynFlags
-> HomeIfaceTable -> HomeSymbolTable
-> PersistentCompilerState
-> Module -> RdrNameHsExpr
- -> IO (PersistentCompilerState, Maybe (PrintUnqualified, RenamedHsExpr))
+ -> IO (PersistentCompilerState, Maybe (PrintUnqualified, (RenamedHsExpr, [RenamedHsDecl])))
renameExpr dflags hit hst pcs this_module expr
| Just iface <- lookupModuleEnv hit this_module
@@ -109,13 +109,11 @@ renameExpr dflags hit hst pcs this_module expr
; let print_unqual = unQualInScope rdr_env
; renameSource dflags hit hst pcs this_module $
- initRnMS rdr_env emptyLocalFixityEnv SourceMode $
- ( rnExpr expr `thenRn` \ (e,_) ->
-
- doptRn Opt_D_dump_rn `thenRn` \ dump_rn ->
- ioToRnM (dumpIfSet dump_rn "Renamer:" (ppr e)) `thenRn_`
-
- returnRn (Just (print_unqual, e)))
+ initRnMS rdr_env emptyLocalFixityEnv SourceMode (rnExpr expr) `thenRn` \ (e,fvs) ->
+ closeDecls [] fvs `thenRn` \ decls ->
+ doptRn Opt_D_dump_rn `thenRn` \ dump_rn ->
+ ioToRnM (dumpIfSet dump_rn "Renamer:" (ppr e)) `thenRn_`
+ returnRn (Just (print_unqual, (e, decls)))
}
| otherwise