Skip to content

Commit 37344ab

Browse files
committed
AST: Use Requirement::getProtocolDecl()
1 parent d8ff967 commit 37344ab

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,14 +1683,11 @@ void PrintAST::printGenericSignature(GenericSignature genericSig,
16831683
static void eraseInvertibleProtocolConformances(
16841684
SmallVectorImpl<Requirement> &requirements) {
16851685
llvm::erase_if(requirements, [&](Requirement req) {
1686-
if (req.getKind() == RequirementKind::Conformance) {
1687-
if (auto protoType = req.getSecondType()->getAs<ProtocolType>()) {
1688-
auto proto = protoType->getDecl();
1689-
return proto->getInvertibleProtocolKind().has_value();
1690-
}
1691-
}
1686+
if (req.getKind() != RequirementKind::Conformance)
1687+
return false;
16921688

1693-
return false;
1689+
return req.getProtocolDecl()
1690+
->getInvertibleProtocolKind().has_value();
16941691
});
16951692
}
16961693

lib/AST/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ Type TypeBase::stripConcurrency(bool recurse, bool dropGlobalActor) {
954954
// If it's a Sendable requirement, skip it.
955955
const auto &req = requirements[reqIdx];
956956
if (req.getKind() == RequirementKind::Conformance &&
957-
req.getSecondType()->castTo<ProtocolType>()->getDecl()
957+
req.getProtocolDecl()
958958
->isSpecificProtocol(KnownProtocolKind::Sendable))
959959
continue;
960960

0 commit comments

Comments
 (0)