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-4386] variadic parameters are interpreted as single argument when passed on #46965

Closed
swift-ci opened this issue Mar 28, 2017 · 0 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-4386
Radar None
Original Reporter cargath (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode Version 8.2.1 (8C1002)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 50967ca2905446880e387c08d6fe04b1

duplicates:

  • SR-128 Pass array to variadic function

Issue Description:

Consider this Playground:

import Foundation

func formatString(with args: CVarArg...) -> String {
    return String(format: "foo %@ %@", args)
}

let stringA = String(format: "foo %@ %@", "bar", "blub") // "foo bar blub"
let stringB = formatString(with: "bar", "blub") // "foo (\n    bar,\n    blub\n) (null)"

Upon inspection, stringA has the correct value of "foo bar blub", but stringB has the value of "foo (\n bar,\n blub\n) (null)". I'm not entirely sure what's happening, but it kinda looks like variadic parameters got converted to a single thing somewhere along the line.

@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
Projects
None yet
Development

No branches or pull requests

1 participant