-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Description
Previous ID | SR-8026 |
Radar | None |
Original Reporter | @dmcyk |
Type | Bug |
Status | Resolved |
Resolution | Invalid |
Attachment: Download
Environment
Xcode 10.0 beta (10L176w)
macOS 10.14 Beta (18A293u)
Swift 4.2
Additional Detail from JIRA
Votes | 0 |
Component/s | |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: bbb8f81c61679f46fa506d5e6bd59bae
Issue Description:
Given Objective-C class with following initializers:
-(id _Nonnull)initWithValue:(NSString* _Nonnull)value;
-(id _Nonnull)initConvenienceWithValue:(NSString* _Nonnull)value;
Where `initConvenienceWithValue:` calls to the designated initializer `initWithValue:`.
When such class is subclassed in Swift, both initializers must be overridden. e.g.
class Child: LeakObject {
let context: Context = {
return Context()
}()
override init(convenienceWithValue value: String) {
super.init(convenienceWithValue: value)
}
override init(value: String) {
super.init(value: value)
}
}
When the convenience initializer is called from Swift, there will be one leaked instance of `Context` object, as it will be allocated twice during Swift 'convenience' initializer call and later when Objective-C calls to its designated initializer.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.