Skip to content

Commit 48d814b

Browse files
committed
AST: Remove ProtocolDecl::requiresInvertible()
1 parent 48f46f0 commit 48d814b

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

include/swift/AST/Decl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5239,10 +5239,6 @@ class ProtocolDecl final : public NominalTypeDecl {
52395239
/// Determine whether this protocol has ~<target>` stated on
52405240
/// itself, one of its inherited types or `Self` requirements.
52415241
InverseMarking::Mark hasInverseMarking(InvertibleProtocolKind target) const;
5242-
5243-
/// Determine whether this protocol requires conformance to `IP`, without
5244-
/// querying a generic signature.
5245-
bool requiresInvertible(InvertibleProtocolKind ip) const;
52465242

52475243
SourceLoc getStartLoc() const { return ProtocolLoc; }
52485244
SourceRange getSourceRange() const {

lib/AST/Decl.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6790,42 +6790,6 @@ ProtocolDecl::hasInverseMarking(InvertibleProtocolKind target) const {
67906790
return InverseMarking::Mark();
67916791
}
67926792

6793-
bool ProtocolDecl::requiresInvertible(InvertibleProtocolKind ip) const {
6794-
// Protocols don't inherit from themselves.
6795-
if (auto thisIP = getInvertibleProtocolKind()) {
6796-
if (thisIP == ip)
6797-
return false;
6798-
}
6799-
6800-
auto kp = ::getKnownProtocolKind(ip);
6801-
6802-
// Otherwise, check for inverses on all of the inherited protocols. If there
6803-
// is one protocol missing an inverse for this `super` protocol, then it is
6804-
// implicitly inherited.
6805-
return walkInheritedProtocols([kp, ip](ProtocolDecl *proto) {
6806-
if (proto->isSpecificProtocol(kp))
6807-
return TypeWalker::Action::Stop; // It is explicitly inherited.
6808-
6809-
// There is no implicit inheritance of an invertible protocol requirement
6810-
// on an invertible protocol itself.
6811-
if (proto->getInvertibleProtocolKind())
6812-
return TypeWalker::Action::Continue;
6813-
6814-
// HACK: claim that Sendable also doesn't implicitly inherit Copyable, etc.
6815-
// This shouldn't be needed after Swift 6.0
6816-
if (proto->isSpecificProtocol(KnownProtocolKind::Sendable))
6817-
return TypeWalker::Action::Continue;
6818-
6819-
// Otherwise, check to see if there's an inverse on this protocol.
6820-
6821-
// The implicit requirement was suppressed on this protocol, keep looking.
6822-
if (proto->hasInverseMarking(ip))
6823-
return TypeWalker::Action::Continue;
6824-
6825-
return TypeWalker::Action::Stop; // No inverse, so implicitly inherited.
6826-
});
6827-
}
6828-
68296793
bool ProtocolDecl::requiresClass() const {
68306794
return evaluateOrDefault(getASTContext().evaluator,
68316795
ProtocolRequiresClassRequest{const_cast<ProtocolDecl *>(this)}, false);

0 commit comments

Comments
 (0)