Skip to content

The build fails because TransferRepresentationBuilder cannot infer type  #64345

@miku1958

Description

@miku1958

Description
TransferRepresentationBuilder does not work.

Steps to reproduce
This code can't be built

import CoreTransferable

@available(macOS 13.0, *)
struct Proxy: Transferable {
    static var transferRepresentation: some TransferRepresentation {
        FileRepresentation(exportedContentType: .mpeg4Movie) { (item: Proxy) -> SentTransferredFile in
            let fileURL = URL(filePath: "")
            return SentTransferredFile(fileURL)
        }.visibility(.all)
    }
}

These some error if I add ".visibility(.all)"
image

I have to change the above code to this so the complier can work

import CoreTransferable

@available(macOS 13.0, *)
struct Proxy: Transferable {
    static var transferRepresentation: some TransferRepresentation {
        let fileRepresentation = FileRepresentation(exportedContentType: .mpeg4Movie) { (item: Proxy) -> SentTransferredFile in
            let fileURL = URL(filePath: "")
            return SentTransferredFile(fileURL)
        }

        return fileRepresentation.visibility(.all)
    }
}

Expected behavior
TransferRepresentationBuilder can work

Environment

  • Swift compiler version info 5.7.2
  • Xcode version info Xcode 14.2
  • Deployment target: macOS 13.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.off topicResolution: Is beyond the scope of the Swift project (Xcode, proprietary Apple frameworks, etc.)swift 5.7

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions