Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-6060] +new not marked SWIFT_UNAVAILABLE when -init is unavailable when using required #48617

Closed
JaviSoto opened this issue Oct 4, 2017 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@JaviSoto
Copy link
Contributor

JaviSoto commented Oct 4, 2017

Previous ID SR-6060
Radar None
Original Reporter @JaviSoto
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 77c42c9bdad15ae41e61c9cdefb46841

duplicates:

  • SR-5018 Mark +new as SWIFT_UNAVAILABLE when -init is SWIFT_UNAVAILABLE.

Issue Description:

Example:

@objc class ParentClass: NSObject {
    init() { }
}

@objc class Subclass: ParentClass {
    required init(parameter: Int) { }
}

The synthesized Obj-C code for the subclass results in:

@interface Subclass : ParentClass
- (nonnull instancetype)initWithParameter:(Int)parameter OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;

/// This one is missing, which means you can call +[Subclass new], which calls the unavailable -[Subclass init]!
/// + (nonnull instancetype)new SWIFT_UNAVAILABLE;
@end
@marcelofabri
Copy link
Contributor

Duplicate of SR-5018?

@belkadan
Copy link
Contributor

belkadan commented Oct 5, 2017

Yep, thanks Marcelo.

@JaviSoto
Copy link
Contributor Author

JaviSoto commented Oct 5, 2017

Ah![]( Thanks a lot)

The other one is IN PROGRESS, but has been since July, so I'm hesitant on abandoning my wip-patch (https://github.com/apple/swift/compare/master...JaviSoto:SR-6060?expand=1)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

3 participants