File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -6379,11 +6379,10 @@ ConstructorDecl *SwiftDeclConverter::importConstructor(
6379
6379
6380
6380
void SwiftDeclConverter::recordObjCOverride (AbstractFunctionDecl *decl) {
6381
6381
// Figure out the class in which this method occurs.
6382
- auto classTy = decl->getDeclContext ()->getDeclaredInterfaceType ()
6383
- ->getAs <ClassType>();
6384
- if (!classTy)
6382
+ auto classDecl = decl->getDeclContext ()->getAsClassOrClassExtensionContext ();
6383
+ if (!classDecl)
6385
6384
return ;
6386
- auto superTy = classTy ->getSuperclass ();
6385
+ auto superTy = classDecl ->getSuperclass ();
6387
6386
if (!superTy)
6388
6387
return ;
6389
6388
// Dig out the Objective-C superclass.
Original file line number Diff line number Diff line change
1
+ @import Foundation;
2
+
3
+ @interface MyIntermediateClass : NSObject
4
+ - (nonnull instancetype )initWithDouble : (double )value NS_DESIGNATED_INITIALIZER;
5
+ @end
6
+
7
+ @interface MyGenericClass <__covariant T> : MyIntermediateClass
8
+ - (nonnull instancetype )initWithValue : (nonnull T)value ;
9
+ @end
10
+
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %S/Inputs/custom-modules -import-objc-header %S/Inputs/objc_init_generics.h %s -verify
2
+
3
+ // REQUIRES: objc_interop
4
+
5
+ // expected-no-diagnostics
6
+
7
+ import Foundation
8
+
9
+ class MyConcreteClass : MyGenericClass < NSObject > {
10
+ // Make sure we don't complain about this "override", because MyGenericClass
11
+ // was getting an init() that was distinct from its superclass's init() due
12
+ // to a bug in the Clang importer.
13
+ init ( ) {
14
+ super. init ( value: NSObject ( ) )
15
+ }
16
+ }
17
+
You can’t perform that action at this time.
0 commit comments