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-15179] Duplicate argument mismatch diagnostic for tuple implosion failure #57502

Closed
hamishknight opened this issue Sep 9, 2021 · 2 comments
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-15179
Radar rdar://problem/82924296
Original Reporter @hamishknight
Type Bug
Status Closed
Resolution Done
Environment

Swift version 5.6-dev (LLVM ca88d53176e346a, Swift d6d814c7f391f42)
Target: x86_64-apple-macosx11.0

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

md5: dce889110b5a8aedc0926684f1f93583

Issue Description:

For the following:

func tuplify<Ts>(_ fn: @escaping (Ts) -> Void) {}
func fn(_ x: inout Int, _ y: inout Int) {}
tuplify(fn)

We don't permit the implosion of the parameters of fn into a tuple, and end up with two fixes, one for the argument mismatch, and one for a contextual missing argument. This leads to a duplicate diagnostic:

error: cannot convert value of type '(inout Int, inout Int) -> ()' to expected argument type '(Int) -> Void' [cannot_convert_argument_value]
tuplify(fn)
        ^
error: cannot convert value of type '(inout Int, inout Int) -> ()' to expected argument type '(Int) -> Void' [cannot_convert_argument_value]
tuplify(fn)
        ^

The same also happens for variadic and isolated parameters, e.g:

func tuplify<Ts>(_ fn: (Ts) -> Void) {}
func fn(x: Int..., y: Int...) {}
tuplify(fn)

actor A {}
func isolatedFn(_ x: isolated A, _ y: isolated A) {}
tuplify(isolatedFn)

Both calls to tuplify produce duplicate diagnostics

@hamishknight
Copy link
Collaborator Author

@swift-ci create

@xedin
Copy link
Member

xedin commented Sep 14, 2021

Fixed by #39257 Please use next available snapshot to verify and close.

@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