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 {
2955
2955
void addRequirements (IterableDeclContext *idc) {
2956
2956
assert (idc->getDecl ()->hasClangNode ());
2957
2957
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.
2960
2959
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))
2962
2969
continue ;
2963
2970
2964
2971
// Skip alternate Swift names for other language modes.
2965
- if (member->getAttrs ().isUnavailable (member-> getASTContext () ))
2972
+ if (member->getAttrs ().isUnavailable (ctx ))
2966
2973
continue ;
2967
2974
2968
2975
// Skip async versions of members. We'll match against the completion
Original file line number Diff line number Diff line change 2
2
3
3
@interface ObjCBaseClass
4
4
5
+ - (instancetype )init __attribute__((unavailable));
5
6
6
7
// Need two initializers to reproduce certain conflict bugs.
7
8
- (instancetype )initFromSuperclass : (int )param __attribute__((objc_designated_initializer));
161
162
162
163
@end
163
164
165
+ @interface ObjCBasicInitClass : ObjCBaseClass
166
+
167
+ - (nonnull instancetype )init __attribute__((objc_designated_initializer));
168
+
169
+ @end
170
+
164
171
165
172
166
173
struct ObjCStruct {
Original file line number Diff line number Diff line change @@ -393,6 +393,12 @@ protocol EmptySwiftProto {}
393
393
}
394
394
}
395
395
396
+ @_objcImplementation extension ObjCBasicInitClass {
397
+ init ( ) {
398
+ // OK
399
+ }
400
+ }
401
+
396
402
@_objcImplementation extension ObjCClass { }
397
403
// expected-error@-1 {{duplicate implementation of Objective-C class 'ObjCClass'}}
398
404
You can’t perform that action at this time.
0 commit comments