Description
Describe the bug
Hello everyone!
I’m looking at distributed actors for my project. While building some PoC i found next issue, which i’m not sure is it an issue for compiler or it’s better to file an issue for https://github.com/nicklockwood/SwiftFormat. When I apply swiftformat for my project i get next change:
- public func remoteCall<Actor, Failure, Success>(
+ public func remoteCall<Actor, Success>(
on _: Actor,
target _: RemoteCallTarget,
invocation _: inout RemoteCallEncoder,
- throwing _: Failure.Type,
+ throwing _: (some Error).Type,
returning _: Success.Type
) async throws -> Success
where Actor: DistributedActor,
Actor.ID == ActorID,
- Failure: Error,
- Success: SerializationRequirement
- {
+ Success: SerializationRequirement {
<some implementation>
}
- public func remoteCallVoid<Actor, Failure>(
+ public func remoteCallVoid<Actor>(
on actor: Actor,
target: RemoteCallTarget,
invocation: inout InvocationEncoder,
- throwing _: Failure.Type
+ throwing _: (some Error).Type
) async throws
where Actor: DistributedActor,
Actor.ID == ActorID,
- Failure: Error
- {
+ {
<some implementation>
while the applicable syntax seems to be correct from language point of view it breaks the conformance to DistributedActorSystem, so i get an error:
error: class 'DistributedSystem' is missing witness for protocol requirement 'remoteCall'
public class DistributedSystem: DistributedActorSystem, @unchecked Sendable {
^
DistributedSystem.swift:11:14: note: protocol 'DistributedActorSystem' requires function 'remoteCall' with signature:
func remoteCall<Act, Err, Res>(
on actor: Act,
target: RemoteCallTarget,
invocation: inout InvocationEncoder,
throwing: Err.Type,
returning: Res.Type
) async throws -> Res
where Act: DistributedActor,
Act.ID == ActorID,
Err: Error,
Res: SerializationRequirement
public class DistributedSystem: DistributedActorSystem, @unchecked Sendable {
^
DistributedSystem.swift:163:29: error: expected type
Actor.ID == ActorID,
^
So, basically it doesn’t like the way how swiftformat changed method signature. If i rollback this particular piece - all work good
Do you think it’s an issue which should be addressed in compiler or should I file a bug for swiftformat that it shouldn’t touch those methods?
Thanks for advice!
Environment
Swift 5.7+
.