From 5ea90a587e80603875d6676a9b07e24d85115973 Mon Sep 17 00:00:00 2001 From: simonpj Date: Wed, 11 Dec 2002 11:59:59 +0000 Subject: [PATCH] [project @ 2002-12-11 11:59:59 by simonpj] Original names can occur in binding positions in External Core --- ghc/compiler/rename/RnEnv.lhs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ghc/compiler/rename/RnEnv.lhs b/ghc/compiler/rename/RnEnv.lhs index 689d9a3..e11b771 100644 --- a/ghc/compiler/rename/RnEnv.lhs +++ b/ghc/compiler/rename/RnEnv.lhs @@ -71,7 +71,10 @@ newTopBinder mod rdr_name loc = returnM name | otherwise - = newGlobalName mod (rdrNameOcc rdr_name) loc + = ASSERT( not (isOrig rdr_name) || rdrNameModule rdr_name == moduleName mod ) + -- When reading External Core we get Orig names as binders, + -- but they should agree with the module gotten from the monad + newGlobalName mod (rdrNameOcc rdr_name) loc newGlobalName :: Module -> OccName -> SrcLoc -> TcRn m Name newGlobalName mod occ loc @@ -233,16 +236,12 @@ lookupTopBndrRn rdr_name -- A separate function (importsFromLocalDecls) reports duplicate top level -- decls, so here it's safe just to choose an arbitrary one. - -- There should never be a qualified name in a binding position in Haskell, - -- but there can be if we have read in an external-Core file. - -- The Haskell parser checks for the illegal qualified name, so we - -- don't need to do so here. +-- There should never be a qualified name in a binding position in Haskell, +-- but there can be if we have read in an external-Core file. +-- The Haskell parser checks for the illegal qualified name in Haskell +-- source files, so we don't need to do so here. - = ASSERT( not (isOrig rdr_name) ) - -- Original names are used only for occurrences, - -- not binding sites - - getModeRn `thenM` \ mode -> + = getModeRn `thenM` \ mode -> case mode of InterfaceMode mod -> getSrcLocM `thenM` \ loc -> @@ -829,7 +828,8 @@ checkDupOrQualNames doc_str rdr_names_w_loc = -- Qualified names in patterns are now rejected by the parser -- but I'm not 100% certain that it finds all cases, so I've left -- this check in for now. Should go eventually. - mappM_ (qualNameErr doc_str) quals `thenM_` + -- Hmm. Sooner rather than later.. data type decls +-- mappM_ (qualNameErr doc_str) quals `thenM_` checkDupNames doc_str rdr_names_w_loc where quals = filter (isQual . fst) rdr_names_w_loc -- 1.7.10.4