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-430] Poor diagnostic when using delegating initializers without self #43047

Closed
swift-ci opened this issue Jan 1, 2016 · 1 comment
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jan 1, 2016

Previous ID SR-430
Radar None
Original Reporter tanadeau (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee None
Priority Medium

md5: 8f428ac4858738ea9e18f96933959219

duplicates:

  • SR-852 [QoI] Poor diagnostic with missing "self." in convenience initializer

Issue Description:

The compiler gives a confusing diagnostic when implementing a delegating initializer and calling init instead of self.init. For example:

struct Check {
    init() {}

    init(name: String) {
        init()
    }
}

This gives the error: "initializers may only be declared within a type".

In this case, I think the error should be something like "delegating initializers must use self.init to call other initializers" with a fix-it to add the "self." prefix.

@rintaro
Copy link
Mannequin

rintaro mannequin commented Feb 17, 2017

Already fixed in #1520

@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. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

1 participant