Skip to content

Commit 5452a89

Browse files
committed
IRGen: Fix createExistentialTypeInfo() for compositions involving ParameterizedProtocolType
1 parent b033982 commit 5452a89

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

lib/IRGen/GenExistential.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,22 +1520,18 @@ static const TypeInfo *createExistentialTypeInfo(IRGenModule &IGM, CanType T) {
15201520
}
15211521

15221522
llvm::StructType *type;
1523-
if (T->hasParameterizedExistential()) {
1524-
type = IGM.createNominalType(T);
1525-
} else {
1526-
// Note: Protocol composition types are not nominal, but we name them
1527-
// anyway.
1528-
if (auto existential = T->getAs<ExistentialType>()) {
1529-
T = existential->getConstraintType()->getCanonicalType();
1530-
}
15311523

1532-
if (isa<ProtocolType>(T))
1533-
type = IGM.createNominalType(T);
1534-
else
1535-
type =
1536-
IGM.createNominalType(cast<ProtocolCompositionType>(T.getPointer()));
1524+
// Note: Protocol composition types are not nominal, but we name them
1525+
// anyway.
1526+
if (auto existential = T->getAs<ExistentialType>()) {
1527+
T = existential->getConstraintType()->getCanonicalType();
15371528
}
15381529

1530+
if (isa<ProtocolType>(T) || isa<ParameterizedProtocolType>(T))
1531+
type = IGM.createNominalType(T);
1532+
else
1533+
type = IGM.createNominalType(cast<ProtocolCompositionType>(T.getPointer()));
1534+
15391535
assert(type->isOpaque() && "creating existential type in concrete struct");
15401536

15411537
// In an opaque metadata, the first two fields are the fixed buffer

0 commit comments

Comments
 (0)