X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcRnDriver.lhs;h=94c55a7f17469ab6825943379cb005e4c9b7415f;hb=366e8db02ab7a5bb5316699bff397d06e47891b2;hp=8cb815f73df32047a83d2b5f6deaa834d1476013;hpb=ab22f4e6456820c1b5169d75f5975a94e61f54ce;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs index 8cb815f..94c55a7 100644 --- a/compiler/typecheck/TcRnDriver.lhs +++ b/compiler/typecheck/TcRnDriver.lhs @@ -167,9 +167,11 @@ tcRnModule hsc_env hsc_src save_rn_syntax traceIf (text "rdr_env: " <+> ppr rdr_env) ; failIfErrsM ; - -- Load any orphan-module interfaces, so that - -- their rules and instance decls will be found - loadOrphanModules (imp_orphs imports) ; + -- Load any orphan-module and family instance-module + -- interfaces, so that their rules and instance decls will be + -- found. + loadOrphanModules (imp_orphs imports) False ; + loadOrphanModules (imp_finsts imports) True ; traceRn (text "rn1a") ; -- Rename and type check the declarations @@ -480,7 +482,7 @@ checkHiBootIface :: TcGblEnv -> ModDetails -> TcM (LHsBinds Id) checkHiBootIface (TcGblEnv { tcg_insts = local_insts, tcg_fam_insts = local_fam_insts, - tcg_type_env = local_type_env, tcg_imports = imports }) + tcg_type_env = local_type_env }) (ModDetails { md_insts = boot_insts, md_fam_insts = boot_fam_insts, md_types = boot_type_env }) = do { traceTc (text "checkHiBootIface" <+> (ppr boot_type_env $$ ppr boot_insts)) ; @@ -495,8 +497,11 @@ checkHiBootIface ; return (unionManyBags dfun_binds) } where check_one boot_thing - | no_check name - = return () + | isImplicitTyThing boot_thing = return () + | name `elem` dfun_names = return () + | isWiredInName name = return () -- No checking for wired-in names. In particular, + -- 'error' is handled by a rather gross hack + -- (see comments in GHC.Err.hs-boot) | Just real_thing <- lookupTypeEnv local_type_env name = do { let boot_decl = tyThingToIfaceDecl boot_thing real_decl = tyThingToIfaceDecl real_thing @@ -509,17 +514,6 @@ checkHiBootIface where name = getName boot_thing - avail_env = imp_parent imports - is_implicit name = case lookupNameEnv avail_env name of - Just (AvailTC tc _) | tc /= name -> True - _otherwise -> False - - no_check name = isWiredInName name -- No checking for wired-in names. In particular, - -- 'error' is handled by a rather gross hack - -- (see comments in GHC.Err.hs-boot) - || name `elem` dfun_names - || is_implicit name -- Has a parent, which we'll check - dfun_names = map getName boot_insts check_inst boot_inst @@ -1098,9 +1092,12 @@ tcGetModuleExports :: Module -> TcM [AvailInfo] tcGetModuleExports mod = do let doc = ptext SLIT("context for compiling statements") iface <- initIfaceTcRn $ loadSysInterface doc mod - loadOrphanModules (dep_orphs (mi_deps iface)) + loadOrphanModules (dep_orphs (mi_deps iface)) False -- Load any orphan-module interfaces, -- so their instances are visible + loadOrphanModules (dep_finsts (mi_deps iface)) True + -- Load any family instance-module interfaces, + -- so all family instances are visible ifaceExportNames (mi_exports iface) tcRnLookupRdrName :: HscEnv -> RdrName -> IO (Maybe [Name])