Skip to content

Commit b033982

Browse files
committed
AST: Fix mangling of compositions involving ParameterizedProtocolType
1 parent 17c1b35 commit b033982

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,14 +1411,18 @@ void ASTMangler::appendType(Type type, GenericSignature sig,
14111411
}
14121412

14131413
case TypeKind::ProtocolComposition: {
1414+
auto *PCT = cast<ProtocolCompositionType>(tybase);
1415+
if (PCT->hasParameterizedExistential())
1416+
return appendConstrainedExistential(PCT, sig, forDecl);
1417+
14141418
// We mangle ProtocolType and ProtocolCompositionType using the
14151419
// same production:
1416-
auto layout = type->getExistentialLayout();
1420+
auto layout = PCT->getExistentialLayout();
14171421
return appendExistentialLayout(layout, sig, forDecl);
14181422
}
14191423

14201424
case TypeKind::ParameterizedProtocol:
1421-
llvm_unreachable("Handled by generalized existential mangling!");
1425+
return appendConstrainedExistential(tybase, sig, forDecl);
14221426

14231427
case TypeKind::Existential: {
14241428
auto *ET = cast<ExistentialType>(tybase);

0 commit comments

Comments
 (0)