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-3839] Ternary operator in convenience initialiser call missing one or more parameters yields an unhelpful error #46424

Closed
hamishknight opened this issue Feb 2, 2017 · 1 comment
Assignees
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 type checker Area → compiler: Semantic analysis

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-3839
Radar None
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Apple Swift version 3.1 (swiftlang-802.0.27.2 clang-802.0.27.2)
Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI, TypeChecker
Assignee @hamishknight
Priority Medium

md5: a02517eeb7ed44ab1b67487fd7179aa5

Issue Description:

class Foo {
    convenience init(a: Int, b: Int) {}
}

let f = Foo(a: true ? 1 : 0) // error: 'Int1' is not convertible to 'Bool'

The expected error would be "Missing argument for parameter 'b' in call".

@xedin
Copy link
Member

xedin commented Aug 22, 2017

Diagnostic has been improved in Swift 4:

Cannot invoke initializer for type 'Foo' with an argument list of type '(a: Int)'

And if you remove `convenience` following error is emitted:

Missing argument for parameter 'b' in call

@hamishknight Please verify using the latest nightly build of Swift compiler.

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

2 participants