Skip to content

Commit a781ca2

Browse files
committed
Sema: Remove a usage of hasInverseMarking()
1 parent 5afdb98 commit a781ca2

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
#include "swift/AST/ForeignErrorConvention.h"
4242
#include "swift/AST/GenericEnvironment.h"
4343
#include "swift/AST/Initializer.h"
44-
#include "swift/AST/InverseMarking.h"
4544
#include "swift/AST/MacroDefinition.h"
4645
#include "swift/AST/NameLookup.h"
4746
#include "swift/AST/NameLookupRequests.h"
@@ -3218,21 +3217,17 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
32183217
static void diagnoseInverseOnClass(ClassDecl *decl) {
32193218
auto &ctx = decl->getASTContext();
32203219

3221-
for (auto ip : InvertibleProtocolSet::full()) {
3222-
auto inverseMarking = decl->hasInverseMarking(ip);
3223-
3224-
// Inferred inverses are already ignored for classes.
3225-
// FIXME: we can also diagnose @_moveOnly here if we use `isAnyExplicit`
3226-
if (!inverseMarking.is(InverseMarking::Kind::Explicit))
3227-
continue;
3220+
InvertibleProtocolSet inverses;
3221+
bool anyObject = false;
3222+
(void) getDirectlyInheritedNominalTypeDecls(decl, inverses, anyObject);
32283223

3224+
for (auto ip : inverses) {
32293225
// Allow ~Copyable when MoveOnlyClasses is enabled
32303226
if (ip == InvertibleProtocolKind::Copyable
32313227
&& ctx.LangOpts.hasFeature(Feature::MoveOnlyClasses))
32323228
continue;
32333229

3234-
3235-
ctx.Diags.diagnose(inverseMarking.getLoc(),
3230+
ctx.Diags.diagnose(decl->getLoc(),
32363231
diag::inverse_on_class,
32373232
getProtocolName(getKnownProtocolKind(ip)));
32383233
}

0 commit comments

Comments
 (0)