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-2475] QoI: Warn about unlabeled parameters following a variadic parameter #45080

Closed
swift-ci opened this issue Aug 25, 2016 · 3 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself good first issue Good for newcomers

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-2475
Radar None
Original Reporter pawlowski (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

OS X 10.11.6, Xcode 8 beta 6

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, StarterBug
Assignee matthew carroll (JIRA)
Priority Medium

md5: e36b6482a71bea3cd3395dbc453dbb1a

relates to:

  • SR-494 Cannot call function with variadic arguments before a required unnamed parameter

Issue Description:

After implementation of SE-0111 variable argument closures seem to be broken.

private let output: (Any..., String, String) -> Void = print
output("does", "not", "work")
output("also", "does", "not", "work")

Compilation fails with "Missing argument for parameter #2 in call"

@belkadan
Copy link
Contributor

AFAIK closure values with variadics have never worked correctly. @DougGregor?

@DougGregor
Copy link
Member

Variadic parameters consume all of the arguments up until a label. The corresponding function and call have the same issue:

func f(_: Any..., _: String, _: String) { }
f("a", "b", "c", "d") // error: missing argument for parameter #2 in call

This is correct behavior, but we should warn about it.

@swift-ci
Copy link
Collaborator Author

Comment by Matthew Carroll (JIRA)

#6823

@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 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants