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-852] [QoI] Poor diagnostic with missing "self." in convenience initializer #43464

Closed
ddunbar opened this issue Mar 1, 2016 · 1 comment
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. class Feature → type declarations: Class declarations compiler The Swift compiler in itself convenience init Feature → declarations → init: Convenience initializers diagnostics QoI Bug: Diagnostics Quality of Implementation parser Area → compiler: The legacy C++ parser

Comments

@ddunbar
Copy link
Member

ddunbar commented Mar 1, 2016

Previous ID SR-852
Radar None
Original Reporter @ddunbar
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee @dduan
Priority Medium

md5: edd5abc26e00e91676bd6ca88d52877d

is duplicated by:

  • SR-430 Poor diagnostic when using delegating initializers without self

Issue Description:

The diagnostic here are pretty bad, Swift should give a fixit and recover nicely:

$ cat t.swift 
class A {
    init(x: Int) {
    }

    convenience init() {
        init(x: 1)
    }
}

$ swiftc -c t.swift 
t.swift:6:13: error: initializers may only be declared within a type
        init(x: 1)
            ^
t.swift:6:17: error: expected parameter type following ':'
        init(x: 1)
                ^
t.swift:6:17: error: expected ',' separator
        init(x: 1)
                ^
               ,
t.swift:6:17: error: expected parameter type following ':'
        init(x: 1)
                ^
t.swift:6:17: error: expected ',' separator
        init(x: 1)
                ^
               ,
@dduan
Copy link
Collaborator

dduan commented Mar 3, 2016

#1520

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added parser Area → compiler: The legacy C++ parser class Feature → type declarations: Class declarations convenience init Feature → declarations → init: Convenience initializers labels Dec 24, 2023
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. class Feature → type declarations: Class declarations compiler The Swift compiler in itself convenience init Feature → declarations → init: Convenience initializers diagnostics QoI Bug: Diagnostics Quality of Implementation parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

3 participants