swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.34k forks source link

[Distributed Actors] Labels of `RemoteCallArgument` do not match documentation #60303

Open s-k opened 2 years ago

s-k commented 2 years ago

Describe the bug

I have played around a little with Xcode 14.0 beta 3 (I currently cannot check beta 4) and have noticed that the behavior regarding RemoteCallArgument does not match the documentation. For these functions, the properties are currently filled as follows:

// label: "a", name: "a", effectiveLabel: "a"
distributed func callMe(a: String) {}

// label: "b", name: "c", effectiveLabel: "b"
distributed func callMe(b c: String) {}

// label: nil, name: "d", effectiveLabel: "d"
distributed func callMe(_ d: String) {}

As per the documentation, in the first case, label should be nil.

I think, the behavior as currently implemented makes much more sense. However, effectiveLabel is now pretty superfluous and returns the wrong string in the third case.

Steps To Reproduce

Define the following distributed actor:

distributed actor TestActor {
    typealias ActorSystem = /* An actor system */

    init(actorSystem: ActorSystem) {
        self.actorSystem = actorSystem
    }

    // label: "a", name: "a", effectiveLabel: "a"
    distributed func callMe(a: String) {}

    // label: "b", name: "c", effectiveLabel: "b"
    distributed func callMe(b c: String) {}

    // label: nil, name: "d", effectiveLabel: "d"
    distributed func callMe(_ d: String) {}
}

Then call each of the distributed methods on an actor proxy. This causes recordArgument() to be called on the distributed actor system with the RemoteCallArgument properties indicated above.

Expected behavior

As per the documentation, in the first case, label should be nil.

Environment

ktoso commented 2 years ago

Thanks for reporting! Will look into it.

rdar://97775548