[project @ 2004-05-07 14:06:45 by simonpj]
authorsimonpj <unknown>
Fri, 7 May 2004 14:06:45 +0000 (14:06 +0000)
committersimonpj <unknown>
Fri, 7 May 2004 14:06:45 +0000 (14:06 +0000)
---------------------------------
Make sure that GHCi loads all
necessary orphan-instance modules
---------------------------------

When you do :m A, we need to load any orphan-instance modules
below A.  That's easily done, but had been forgotten.

Do not merge to stable: the fix is different there

ghc/compiler/typecheck/TcRnDriver.lhs

index 0e4a93b..eddc460 100644 (file)
@@ -62,7 +62,7 @@ import TyCon          ( tyConHasGenerics )
 import SrcLoc          ( srcLocSpan, Located(..), noLoc )
 import Outputable
 import HscTypes                ( ModGuts(..), HscEnv(..),
-                         GhciMode(..), noDependencies,
+                         GhciMode(..), Dependencies(..), noDependencies,
                          Deprecs( NoDeprecs ), plusDeprecs,
                          ForeignStubs(NoStubs), TypeEnv, 
                          extendTypeEnvWithIds, typeEnvIds, typeEnvTyCons,
@@ -847,6 +847,9 @@ mkExportEnv hsc_env exports
 getModuleExports :: ModuleName -> TcM GlobalRdrEnv
 getModuleExports mod 
   = do { iface <- load_iface mod
+       ; loadOrphanModules (dep_orphs (mi_deps iface))
+                       -- Load any orphan-module interfaces,
+                       -- so their instances are visible
        ; avails <- exportsToAvails (mi_exports iface)
        ; let { gres =  [ GRE  { gre_name = name, gre_prov = vanillaProv mod }
                        | avail <- avails, name <- availNames avail ] }