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-15031] SE-0293 Calling function with omitted label for projected value $_ do not compile #57358

Closed
mattyoung opened this issue Aug 5, 2021 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@mattyoung
Copy link

Previous ID SR-15031
Radar None
Original Reporter @mattyoung
Type Bug
Status Resolved
Resolution Done
Environment

Xcode Version 13.0 beta 4 (13A5201i)

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

md5: 825ff2b80b218ae8b4a918c8a887e873

Issue Description:

Create a Xcode SwiftUI iOS app project, paste this into ContentView.swift:

import SwiftUI

struct User: Identifiable {
    let id = UUID()
    var name: String
    var isContacted = false
}

final class Model: ObservableObject {
    @Published var users: [User]

    init(_ users: [User]) {
        self.users = users
    }
}

struct ContentView: View {
    @EnvironmentObject private var model: Model

    var body: some View {
        List($model.users) { $user in
            itemView($_: $user)     // <=== !!! Compiler error here: Extraneous argument label '$_:' in call
        }
    }

    func itemView(@Binding _ user: User) -> some View {
        EmptyView()
    }
}

See https://forums.swift.org/t/for-swiftui-list-rowcontent-how-to-define-a-func-with-a-binding-property-wrapper-as-parameter/50782/9

@amritpan
Copy link
Contributor

amritpan commented Sep 6, 2021

#39188

@amritpan
Copy link
Contributor

amritpan commented Oct 1, 2021

PR merged 🙂

@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

2 participants