File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ Name: ObjCParseExtras
2
+ Classes:
3
+ - Name: SubclassWithSwiftPrivateDesignatedInit
4
+ Methods:
5
+ - Selector: "initWithI:"
6
+ MethodKind: Instance
7
+ SwiftPrivate: true
Original file line number Diff line number Diff line change @@ -249,3 +249,14 @@ struct TrivialToCopy {
249
249
250
250
@interface OverrideInExtensionSub : OverrideInExtensionBase
251
251
@end
252
+
253
+ @interface SuperclassWithDesignatedInitInCategory
254
+ @end
255
+
256
+ @interface SubclassWithSwiftPrivateDesignatedInit : SuperclassWithDesignatedInitInCategory
257
+ -(instancetype ) initWithI : (NSInteger )i __attribute__((objc_designated_initializer));
258
+ @end
259
+
260
+ @interface SuperclassWithDesignatedInitInCategory ()
261
+ -(instancetype ) initWithI : (NSInteger )i __attribute__((objc_designated_initializer));
262
+ @end
Original file line number Diff line number Diff line change @@ -197,3 +197,16 @@ func classPropertiesAreNotInit() -> ProcessInfo {
197
197
procInfo = ProcessInfo . processInfo // okay
198
198
return procInfo
199
199
}
200
+
201
+ // Make sure we can still inherit a convenience initializer when we have a
202
+ // designated initializer override in Obj-C that isn't considered a proper
203
+ // override in Swift. In this case, both the superclass and subclass have a
204
+ // designed init with the selector `initWithI:`, however the Swift signature for
205
+ // the subclass' init is `init(__i:)` rather than `init(i:)`.
206
+ extension SuperclassWithDesignatedInitInCategory {
207
+ convenience init ( y: Int ) { self . init ( i: y) }
208
+ }
209
+
210
+ func testConvenienceInitInheritance( ) {
211
+ _ = SubclassWithSwiftPrivateDesignatedInit ( y: 5 )
212
+ }
You can’t perform that action at this time.
0 commit comments