Skip to content

Commit f36b509

Browse files
committed
AST: Remove ProtocolDecl::hasInverseMarking()
1 parent 1262662 commit f36b509

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

include/swift/AST/Decl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5254,10 +5254,6 @@ class ProtocolDecl final : public NominalTypeDecl {
52545254
/// Determine whether this protocol inherits from the given ("super")
52555255
/// protocol.
52565256
bool inheritsFrom(const ProtocolDecl *Super) const;
5257-
5258-
/// Determine whether this protocol has ~<target>` stated on
5259-
/// itself, one of its inherited types or `Self` requirements.
5260-
InverseMarking::Mark hasInverseMarking(InvertibleProtocolKind target) const;
52615257

52625258
SourceLoc getStartLoc() const { return ProtocolLoc; }
52635259
SourceRange getSourceRange() const {

lib/AST/Decl.cpp

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6688,8 +6688,7 @@ NominalTypeDecl::hasInverseMarking(InvertibleProtocolKind target) const {
66886688
if (isa<BuiltinTupleDecl>(this))
66896689
return InverseMarking::Mark(InverseMarking::Kind::Explicit);
66906690

6691-
if (auto P = dyn_cast<ProtocolDecl>(this))
6692-
return P->hasInverseMarking(target);
6691+
assert(!isa<ProtocolDecl>(this));
66936692

66946693
// Search the inheritance clause first.
66956694
if (auto inverse = findInverseInInheritance(getInherited(), target))
@@ -6698,41 +6697,6 @@ NominalTypeDecl::hasInverseMarking(InvertibleProtocolKind target) const {
66986697
return InverseMarking::Mark();
66996698
}
67006699

6701-
InverseMarking::Mark
6702-
ProtocolDecl::hasInverseMarking(InvertibleProtocolKind target) const {
6703-
auto &ctx = getASTContext();
6704-
6705-
// Legacy support stops here.
6706-
if (!ctx.LangOpts.hasFeature(Feature::NoncopyableGenerics))
6707-
return InverseMarking::Mark();
6708-
6709-
if (auto inverse = findInverseInInheritance(getInherited(), target))
6710-
return inverse;
6711-
6712-
auto *whereClause = getTrailingWhereClause();
6713-
if (!whereClause)
6714-
return InverseMarking::Mark();
6715-
6716-
for (const auto &reqRepr : whereClause->getRequirements()) {
6717-
if (reqRepr.isInvalid() ||
6718-
reqRepr.getKind() != RequirementReprKind::TypeConstraint)
6719-
continue;
6720-
6721-
auto *subjectRepr =
6722-
dyn_cast<UnqualifiedIdentTypeRepr>(reqRepr.getSubjectRepr());
6723-
auto *constraintRepr = reqRepr.getConstraintRepr();
6724-
6725-
if (!subjectRepr || !subjectRepr->getNameRef().isSimpleName(ctx.Id_Self))
6726-
continue;
6727-
6728-
if (constraintRepr->isInverseOf(target, getDeclContext()))
6729-
return InverseMarking::Mark(InverseMarking::Kind::Explicit,
6730-
constraintRepr->getLoc());
6731-
}
6732-
6733-
return InverseMarking::Mark();
6734-
}
6735-
67366700
bool ProtocolDecl::requiresClass() const {
67376701
return evaluateOrDefault(getASTContext().evaluator,
67386702
ProtocolRequiresClassRequest{const_cast<ProtocolDecl *>(this)}, false);

0 commit comments

Comments
 (0)