[project @ 2005-08-09 16:58:39 by simonpj]
authorsimonpj <unknown>
Tue, 9 Aug 2005 16:58:39 +0000 (16:58 +0000)
committersimonpj <unknown>
Tue, 9 Aug 2005 16:58:39 +0000 (16:58 +0000)
Wibble to loadHomeInterface for TH quoting; MERGE to STABLE

ghc/compiler/iface/LoadIface.lhs
ghc/compiler/rename/RnExpr.lhs

index 70e09c9..f24cb64 100644 (file)
@@ -40,7 +40,7 @@ import PrelRules      ( builtinRules )
 import Rules           ( extendRuleBaseList, mkRuleBase )
 import InstEnv         ( emptyInstEnv, extendInstEnvList )
 import Name            ( Name {-instance NamedThing-}, getOccName,
-                         nameModule, isInternalName, isWiredInName )
+                         nameModule, nameIsLocalOrFrom, isWiredInName )
 import NameEnv
 import MkId            ( seqId )
 import Module          ( Module, ModLocation(ml_hi_file), emptyModuleEnv, 
@@ -101,8 +101,14 @@ loadOrphanModules mods
 ---------------
 loadHomeInterface :: SDoc -> Name -> TcRn ModIface
 loadHomeInterface doc name
-  = ASSERT2( not (isInternalName name), ppr name <+> parens doc )
-    initIfaceTcRn $ loadSysInterface doc (nameModule name)
+  = do { 
+#ifdef DEBUG
+               -- Should not be called with a name from the module being compiled
+         this_mod <- getModule
+       ; ASSERT2( not (nameIsLocalOrFrom this_mod name), ppr name <+> parens doc )
+#endif
+         initIfaceTcRn $ loadSysInterface doc (nameModule name)
+    }
 
 ---------------
 loadWiredInHomeIface :: Name -> IfM lcl ()
index ad7ddc5..c252080 100644 (file)
@@ -33,7 +33,7 @@ import BasicTypes     ( FixityDirection(..) )
 import PrelNames       ( hasKey, assertIdKey, assertErrorName,
                          loopAName, choiceAName, appAName, arrAName, composeAName, firstAName,
                          negateName, thenMName, bindMName, failMName )
-import Name            ( Name, nameOccName )
+import Name            ( Name, nameOccName, nameIsLocalOrFrom )
 import NameSet
 import RdrName         ( RdrName, emptyGlobalRdrEnv, extendLocalRdrEnv, lookupLocalRdrEnv )
 import LoadIface       ( loadHomeInterface )
@@ -528,9 +528,10 @@ rnRbinds str rbinds
 
 \begin{code}
 rnBracket (VarBr n) = do { name <- lookupOccRn n
-                        ; loadHomeInterface msg name   -- Reason: deprecation checking asumes the
-                                                       -- home interface is loaded, and this is the
-                                                       -- only way that is going to happen
+                        ; this_mod <- getModule
+                        ; checkM (nameIsLocalOrFrom this_mod name) $   -- Reason: deprecation checking asumes the
+                          do { loadHomeInterface msg name              -- home interface is loaded, and this is the
+                             ; return () }                             -- only way that is going to happen
                         ; returnM (VarBr name, unitFV name) }
                    where
                      msg = ptext SLIT("Need interface for Template Haskell quoted Name")