mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: Use new form of getOpenedExistentialSignature() in emitExtendedExistentialTypeShape()
This commit is contained in:
@@ -34,6 +34,7 @@ public:
|
||||
CanGenericSignature genSig;
|
||||
CanType shapeType;
|
||||
SubstitutionMap genSubs; // optional
|
||||
CanGenericSignature reqSig;
|
||||
FormalLinkage linkage;
|
||||
|
||||
/// Get the extended existential type shape for the given
|
||||
|
||||
@@ -7389,36 +7389,34 @@ ExtendedExistentialTypeShapeInfo::get(CanType existentialType) {
|
||||
existentialType = metatype.getInstanceType();
|
||||
}
|
||||
|
||||
auto genInfo = ExistentialTypeGeneralization::get(existentialType);
|
||||
auto &ctx = existentialType->getASTContext();
|
||||
auto existentialSig = ctx.getOpenedExistentialSignature(existentialType);
|
||||
|
||||
auto result = get(genInfo, metatypeDepth);
|
||||
result.genSubs = genInfo.Generalization;
|
||||
return result;
|
||||
}
|
||||
|
||||
ExtendedExistentialTypeShapeInfo
|
||||
ExtendedExistentialTypeShapeInfo::get(
|
||||
const ExistentialTypeGeneralization &genInfo,
|
||||
unsigned metatypeDepth) {
|
||||
auto shapeType = genInfo.Shape->getCanonicalType();
|
||||
auto shapeType = existentialSig.Shape;
|
||||
for (unsigned i = 0; i != metatypeDepth; ++i)
|
||||
shapeType = CanExistentialMetatypeType::get(shapeType);
|
||||
|
||||
CanGenericSignature genSig;
|
||||
if (genInfo.Generalization)
|
||||
genSig = genInfo.Generalization.getGenericSignature()
|
||||
.getCanonicalSignature();
|
||||
if (existentialSig.Generalization) {
|
||||
genSig = existentialSig.Generalization.getGenericSignature()
|
||||
.getCanonicalSignature();
|
||||
}
|
||||
|
||||
auto linkage = getExistentialShapeLinkage(genSig, shapeType);
|
||||
assert(linkage != FormalLinkage::PublicUnique && linkage != FormalLinkage::PackageUnique);
|
||||
|
||||
return { genSig, shapeType, SubstitutionMap(), linkage };
|
||||
return {genSig,
|
||||
shapeType,
|
||||
existentialSig.Generalization,
|
||||
existentialSig.OpenedSig,
|
||||
linkage};
|
||||
}
|
||||
|
||||
llvm::Constant *
|
||||
irgen::emitExtendedExistentialTypeShape(IRGenModule &IGM,
|
||||
const ExtendedExistentialTypeShapeInfo &info) {
|
||||
CanGenericSignature genSig = info.genSig;
|
||||
CanGenericSignature reqSig = info.reqSig;
|
||||
CanType shapeType = info.shapeType;
|
||||
bool isUnique = info.isUnique();
|
||||
bool isShared = info.isShared();
|
||||
@@ -7451,11 +7449,9 @@ irgen::emitExtendedExistentialTypeShape(IRGenModule &IGM,
|
||||
metatypeDepth++;
|
||||
}
|
||||
|
||||
CanGenericSignature reqSig =
|
||||
IGM.Context.getOpenedExistentialSignature(existentialType, genSig);
|
||||
|
||||
CanType typeExpression;
|
||||
if (metatypeDepth > 0) {
|
||||
// FIXME: reqSig.getGenericParams()[0] is always tau_0_0
|
||||
typeExpression = CanType(reqSig.getGenericParams()[0]);
|
||||
for (unsigned i = 0; i != metatypeDepth; ++i)
|
||||
typeExpression = CanMetatypeType::get(typeExpression);
|
||||
|
||||
Reference in New Issue
Block a user