@@ -7389,36 +7389,34 @@ ExtendedExistentialTypeShapeInfo::get(CanType existentialType) {
73897389 existentialType = metatype.getInstanceType ();
73907390 }
73917391
7392- auto genInfo = ExistentialTypeGeneralization::get (existentialType);
7392+ auto &ctx = existentialType->getASTContext ();
7393+ auto existentialSig = ctx.getOpenedExistentialSignature (existentialType);
73937394
7394- auto result = get (genInfo, metatypeDepth);
7395- result.genSubs = genInfo.Generalization ;
7396- return result;
7397- }
7398-
7399- ExtendedExistentialTypeShapeInfo
7400- ExtendedExistentialTypeShapeInfo::get (
7401- const ExistentialTypeGeneralization &genInfo,
7402- unsigned metatypeDepth) {
7403- auto shapeType = genInfo.Shape ->getCanonicalType ();
7395+ auto shapeType = existentialSig.Shape ;
74047396 for (unsigned i = 0 ; i != metatypeDepth; ++i)
74057397 shapeType = CanExistentialMetatypeType::get (shapeType);
74067398
74077399 CanGenericSignature genSig;
7408- if (genInfo.Generalization )
7409- genSig = genInfo.Generalization .getGenericSignature ()
7410- .getCanonicalSignature ();
7400+ if (existentialSig.Generalization ) {
7401+ genSig = existentialSig.Generalization .getGenericSignature ()
7402+ .getCanonicalSignature ();
7403+ }
74117404
74127405 auto linkage = getExistentialShapeLinkage (genSig, shapeType);
74137406 assert (linkage != FormalLinkage::PublicUnique && linkage != FormalLinkage::PackageUnique);
74147407
7415- return { genSig, shapeType, SubstitutionMap (), linkage };
7408+ return {genSig,
7409+ shapeType,
7410+ existentialSig.Generalization ,
7411+ existentialSig.OpenedSig ,
7412+ linkage};
74167413}
74177414
74187415llvm::Constant *
74197416irgen::emitExtendedExistentialTypeShape (IRGenModule &IGM,
74207417 const ExtendedExistentialTypeShapeInfo &info) {
74217418 CanGenericSignature genSig = info.genSig ;
7419+ CanGenericSignature reqSig = info.reqSig ;
74227420 CanType shapeType = info.shapeType ;
74237421 bool isUnique = info.isUnique ();
74247422 bool isShared = info.isShared ();
@@ -7451,11 +7449,9 @@ irgen::emitExtendedExistentialTypeShape(IRGenModule &IGM,
74517449 metatypeDepth++;
74527450 }
74537451
7454- CanGenericSignature reqSig =
7455- IGM.Context .getOpenedExistentialSignature (existentialType, genSig);
7456-
74577452 CanType typeExpression;
74587453 if (metatypeDepth > 0 ) {
7454+ // FIXME: reqSig.getGenericParams()[0] is always tau_0_0
74597455 typeExpression = CanType (reqSig.getGenericParams ()[0 ]);
74607456 for (unsigned i = 0 ; i != metatypeDepth; ++i)
74617457 typeExpression = CanMetatypeType::get (typeExpression);
0 commit comments