Skip to content

Commit 9046799

Browse files
authored
Merge pull request #30274 from CodaFi/the-mac-in-the-mirror
[ObjC] Only Diagnose Selector Conflicts From Classes
2 parents a09b641 + bf6fe03 commit 9046799

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Sema/TypeCheckDeclObjC.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,6 +2035,11 @@ bool swift::diagnoseUnintendedObjCMethodOverrides(SourceFile &sf) {
20352035
continue;
20362036
}
20372037

2038+
// Require the declaration to actually come from a class. Selectors that
2039+
// come from protocol requirements are not actually overrides.
2040+
if (!overriddenMethod->getDeclContext()->getSelfClassDecl())
2041+
continue;
2042+
20382043
// Diagnose the override.
20392044
auto methodDiagInfo = getObjCMethodDiagInfo(method);
20402045
auto overriddenDiagInfo = getObjCMethodDiagInfo(overriddenMethod);

0 commit comments

Comments
 (0)