File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -2955,14 +2955,21 @@ class ObjCImplementationChecker {
29552955 void addRequirements (IterableDeclContext *idc) {
29562956 assert (idc->getDecl ()->hasClangNode ());
29572957 for (Decl *_member : idc->getMembers ()) {
2958- // Skip accessors; we'll match their storage instead. Also skip overrides;
2959- // the override checker handles those.
2958+ // Skip accessors; we'll match their storage instead.
29602959 auto member = dyn_cast<ValueDecl>(_member);
2961- if (!member || isa<AccessorDecl>(member) || member->getOverriddenDecl ())
2960+ if (!member || isa<AccessorDecl>(member))
2961+ continue ;
2962+
2963+ ASTContext &ctx = member->getASTContext ();
2964+
2965+ // Also skip overrides, unless they override an unavailable decl, which
2966+ // makes them not formally overrides anymore.
2967+ if (member->getOverriddenDecl () &&
2968+ !member->getOverriddenDecl ()->getAttrs ().isUnavailable (ctx))
29622969 continue ;
29632970
29642971 // Skip alternate Swift names for other language modes.
2965- if (member->getAttrs ().isUnavailable (member-> getASTContext () ))
2972+ if (member->getAttrs ().isUnavailable (ctx ))
29662973 continue ;
29672974
29682975 // Skip async versions of members. We'll match against the completion
Original file line number Diff line number Diff line change 22
33@interface ObjCBaseClass
44
5+ - (instancetype )init __attribute__((unavailable));
56
67// Need two initializers to reproduce certain conflict bugs.
78- (instancetype )initFromSuperclass : (int )param __attribute__((objc_designated_initializer));
161162
162163@end
163164
165+ @interface ObjCBasicInitClass : ObjCBaseClass
166+
167+ - (nonnull instancetype )init __attribute__((objc_designated_initializer));
168+
169+ @end
170+
164171
165172
166173struct ObjCStruct {
Original file line number Diff line number Diff line change @@ -393,6 +393,12 @@ protocol EmptySwiftProto {}
393393 }
394394}
395395
396+ @_objcImplementation extension ObjCBasicInitClass {
397+ init ( ) {
398+ // OK
399+ }
400+ }
401+
396402@_objcImplementation extension ObjCClass { }
397403// expected-error@-1 {{duplicate implementation of Objective-C class 'ObjCClass'}}
398404
You can’t perform that action at this time.
0 commit comments