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-4681] custom init on nsobject subclass which throws isn't accepted #47258

Open
swift-ci opened this issue Apr 24, 2017 · 2 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself feature A feature request or implementation

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-4681
Radar None
Original Reporter chriseidhof (JIRA User)
Type Bug
Environment

Version 8.3.2 (8E2002), default Swift.

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, LanguageFeatureRequest
Assignee None
Priority Medium

md5: a37a0cb22a15400855e3e83876122ded

Issue Description:

I have a very simple NSObject subclass which has a custom initializer that throws:

{{final class Test: NSObject {
init() throws {
// custom behavior
super.init()
}
}
}}

The compiler tells me that I should add the override label (I don't think it should). When I do add the override label, it tells me that it's not overriding anything.

@belkadan
Copy link
Contributor

We don't really have a good way to say "I don't want to inherit initializers, but I do want to reuse some of the signatures." A nonoverride kind of keyword would fix that.

@belkadan
Copy link
Contributor

You can work around this in a very silly way by adding another level of base class in between with a dummy initializer that isn't init().

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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. compiler The Swift compiler in itself feature A feature request or implementation
Projects
None yet
Development

No branches or pull requests

2 participants