X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fiface%2FMkIface.lhs;h=3bc9257c65ab978a255829a1ad1dea3d5ac20ff3;hb=14a3631d5b7a49fef47a221f548dc7d021810de9;hp=7901f7c5142325b9ca5a7e702e050e305394d46e;hpb=e8a591c1a3dbdeccec2dd2aacccd7435004b0d51;p=ghc-hetmet.git diff --git a/compiler/iface/MkIface.lhs b/compiler/iface/MkIface.lhs index 7901f7c..3bc9257 100644 --- a/compiler/iface/MkIface.lhs +++ b/compiler/iface/MkIface.lhs @@ -190,10 +190,12 @@ import TyCon ( TyCon, AlgTyConRhs(..), SynTyConRhs(..), isSynTyCon, isAlgTyCon, isPrimTyCon, isFunTyCon, isTupleTyCon, tupleTyConBoxity, tyConStupidTheta, tyConHasGenerics, synTyConRhs, isGadtSyntaxTyCon, - tyConArity, tyConTyVars, algTyConRhs, tyConExtName ) + tyConArity, tyConTyVars, algTyConRhs, tyConExtName, + tyConFamInst_maybe, tyConFamInstIndex ) import DataCon ( dataConName, dataConFieldLabels, dataConStrictMarks, - dataConTyCon, dataConIsInfix, dataConUnivTyVars, dataConExTyVars, dataConEqSpec, - dataConTheta, dataConOrigArgTys ) + dataConTyCon, dataConIsInfix, dataConUnivTyVars, + dataConExTyVars, dataConEqSpec, dataConTheta, + dataConOrigArgTys ) import Type ( TyThing(..), splitForAllTys, funResultTy ) import TcType ( deNoteType ) import TysPrim ( alphaTyVars ) @@ -377,17 +379,17 @@ mkExtNameFn hsc_env eps this_mod occ = nameOccName name par_occ = nameOccName (nameParent name) -- The version of the *parent* is the one want - vers = lookupVersion mod par_occ + vers = lookupVersion mod par_occ occ - lookupVersion :: Module -> OccName -> Version + lookupVersion :: Module -> OccName -> OccName -> Version -- Even though we're looking up a home-package thing, in -- one-shot mode the imported interfaces may be in the PIT - lookupVersion mod occ - = mi_ver_fn iface occ `orElse` - pprPanic "lookupVers1" (ppr mod <+> ppr occ) + lookupVersion mod par_occ occ + = mi_ver_fn iface par_occ `orElse` + pprPanic "lookupVers1" (ppr mod <+> ppr par_occ <+> ppr occ) where iface = lookupIfaceByModule (hsc_dflags hsc_env) hpt pit mod `orElse` - pprPanic "lookupVers2" (ppr mod <+> ppr occ) + pprPanic "lookupVers2" (ppr mod <+> ppr par_occ <+> ppr occ) --------------------- @@ -997,10 +999,12 @@ tyThingToIfaceDecl ext (AClass clas) ifName = getOccName clas, ifTyVars = toIfaceTvBndrs clas_tyvars, ifFDs = map toIfaceFD clas_fds, + ifATs = map (tyThingToIfaceDecl ext . ATyCon) clas_ats, ifSigs = map toIfaceClassOp op_stuff, ifRec = boolToRecFlag (isRecursiveTyCon tycon) } where - (clas_tyvars, clas_fds, sc_theta, _, op_stuff) = classExtraBigSig clas + (clas_tyvars, clas_fds, sc_theta, _, clas_ats, op_stuff) + = classExtraBigSig clas tycon = classTyCon clas toIfaceClassOp (sel_id, def_meth) @@ -1031,7 +1035,9 @@ tyThingToIfaceDecl ext (ATyCon tycon) ifCons = ifaceConDecls (algTyConRhs tycon), ifRec = boolToRecFlag (isRecursiveTyCon tycon), ifGadtSyntax = isGadtSyntaxTyCon tycon, - ifGeneric = tyConHasGenerics tycon } + ifGeneric = tyConHasGenerics tycon, + ifFamInst = famInstToIface (tyConFamInst_maybe tycon) + (tyConFamInstIndex tycon) } | isForeignTyCon tycon = IfaceForeign { ifName = getOccName tycon, @@ -1045,7 +1051,8 @@ tyThingToIfaceDecl ext (ATyCon tycon) ifCons = IfAbstractTyCon, ifGadtSyntax = False, ifGeneric = False, - ifRec = NonRecursive} + ifRec = NonRecursive, + ifFamInst = Nothing } | otherwise = pprPanic "toIfaceDecl" (ppr tycon) where @@ -1073,12 +1080,18 @@ tyThingToIfaceDecl ext (ATyCon tycon) ifConExTvs = toIfaceTvBndrs (dataConExTyVars data_con), ifConEqSpec = to_eq_spec (dataConEqSpec data_con), ifConCtxt = toIfaceContext ext (dataConTheta data_con), - ifConArgTys = map (toIfaceType ext) (dataConOrigArgTys data_con), - ifConFields = map getOccName (dataConFieldLabels data_con), + ifConArgTys = map (toIfaceType ext) + (dataConOrigArgTys data_con), + ifConFields = map getOccName + (dataConFieldLabels data_con), ifConStricts = dataConStrictMarks data_con } to_eq_spec spec = [(getOccName tv, toIfaceType ext ty) | (tv,ty) <- spec] + famInstToIface Nothing _ = Nothing + famInstToIface (Just (famTyCon, instTys)) index = + Just (toIfaceTyCon ext famTyCon, map (toIfaceType ext) instTys, index) + tyThingToIfaceDecl ext (ADataCon dc) = pprPanic "toIfaceDecl" (ppr dc) -- Should be trimmed out earlier