mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The proposal was [accepted with modifications](https://forums.swift.org/t/accepted-with-modifications-se-0428-resolve-distributedactor-protocols/71366) The decision was made to change the spelling of the attached macro in the proposal from @DistributedProtocol to `@Resolvable` (or `@Distributed.Resolvable` if disambiguation is needed).
67 lines
2.1 KiB
Swift
67 lines
2.1 KiB
Swift
// REQUIRES: swift_swift_parser, asserts
|
|
//
|
|
// UNSUPPORTED: back_deploy_concurrency
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: distributed
|
|
//
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %empty-directory(%t-scratch)
|
|
|
|
// RUN: %target-swift-frontend -typecheck -verify -disable-availability-checking -plugin-path %swift-plugin-dir -I %t -dump-macro-expansions %s 2>&1 | %FileCheck %s
|
|
|
|
import Distributed
|
|
|
|
typealias System = LocalTestingDistributedActorSystem
|
|
|
|
@Resolvable
|
|
protocol Base: DistributedActor where ActorSystem: DistributedActorSystem<any Codable> {
|
|
distributed func base() -> Int
|
|
}
|
|
// CHECK: distributed actor $Base<ActorSystem>: Base
|
|
// CHECK: Distributed._DistributedActorStub
|
|
// CHECK: where ActorSystem: DistributedActorSystem<any Codable>
|
|
// CHECK: {
|
|
// CHECK: }
|
|
|
|
// CHECK: extension Base where Self: Distributed._DistributedActorStub {
|
|
// CHECK: distributed func base() -> Int {
|
|
// CHECK: if #available(SwiftStdlib 6.0, *) {
|
|
// CHECK: Distributed._distributedStubFatalError()
|
|
// CHECK: } else {
|
|
// CHECK: fatalError()
|
|
// CHECK: }
|
|
// CHECK: }
|
|
// CHECK: }
|
|
|
|
// ==== ------------------------------------------------------------------------
|
|
|
|
@Resolvable
|
|
protocol G3<ActorSystem>: DistributedActor, Base where ActorSystem: DistributedActorSystem<any Codable> {
|
|
distributed func get() -> String
|
|
distributed func greet(name: String) -> String
|
|
}
|
|
|
|
// CHECK: distributed actor $G3<ActorSystem>: G3
|
|
// CHECK: Distributed._DistributedActorStub
|
|
// CHECK: where ActorSystem: DistributedActorSystem<any Codable>
|
|
// CHECK: {
|
|
// CHECK: }
|
|
|
|
// CHECK: extension G3 where Self: Distributed._DistributedActorStub {
|
|
// CHECK: distributed func get() -> String {
|
|
// CHECK: if #available(SwiftStdlib 6.0, *) {
|
|
// CHECK: Distributed._distributedStubFatalError()
|
|
// CHECK: } else {
|
|
// CHECK: fatalError()
|
|
// CHECK: }
|
|
// CHECK: }
|
|
// CHECK: distributed func greet(name: String) -> String {
|
|
// CHECK: if #available(SwiftStdlib 6.0, *) {
|
|
// CHECK: Distributed._distributedStubFatalError()
|
|
// CHECK: } else {
|
|
// CHECK: fatalError()
|
|
// CHECK: }
|
|
// CHECK: }
|
|
// CHECK: }
|
|
|