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-1644] Issue with varargs #44253

Closed
swift-ci opened this issue May 30, 2016 · 1 comment
Closed

[SR-1644] Issue with varargs #44253

swift-ci opened this issue May 30, 2016 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1644
Radar None
Original Reporter svanimpe (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

Xcode 7.3.1

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

md5: 05a529c67c59d9098972e7cca46dec04

duplicates:

  • SR-128 Pass array to variadic function

Issue Description:

The following code does not compile (see the attached screenshot). Is Item... not the same type as Item... (namely [Item])?

struct List<Item> {
    
    var items: [Item] = []

    init(items: Item...) {
        self.items = items
    }
}

extension List: ArrayLiteralConvertible {
    
    typealias Element = Item
    
    init(arrayLiteral elements: Item...) {
        self.init(items: elements)
    }
}
@belkadan
Copy link
Contributor

Within the function, the type of elements is [Item], which is indeed different from Item.... (The difference would be important if you had a function that took Any....)

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

No branches or pull requests

2 participants