Files
swift-mirror/test/Distributed/Macros/distributed_macro_expansion_DistributedProtocol_simple.swift
Pavel Yaskevich e6b445b8d1 [SE-0428] NFC: Rename _DistributedProtocol macro into Resolvable
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).
2024-04-22 14:18:11 -07:00

48 lines
1.4 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 -dump-macro-expansions 2>&1 | %FileCheck %s
import Distributed
@Resolvable
protocol Greeter: DistributedActor where ActorSystem: DistributedActorSystem<any Codable> {
distributed func greet(name: String) -> String
}
// @Resolvable ->
// CHECK: distributed actor $Greeter<ActorSystem>: Greeter,
// CHECK-NEXT: Distributed._DistributedActorStub
// CHECK-NEXT: where ActorSystem: DistributedActorSystem<any Codable>
// CHECK-NEXT: {
// CHECK-NEXT: }
// CHECK: extension Greeter where Self: Distributed._DistributedActorStub {
// CHECK-NEXT: distributed func greet(name: String) -> String {
// CHECK-NEXT: if #available(SwiftStdlib 6.0, *) {
// CHECK-NEXT: Distributed._distributedStubFatalError()
// CHECK-NEXT: } else {
// CHECK-NEXT: fatalError()
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
// Macro should be able to handle complex properties
@Resolvable
public protocol GetSet: DistributedActor, Sendable
where ActorSystem: DistributedActorSystem<any Codable> {
distributed var dist: String { get }
var getSet: String { get set }
var asyncGetSet: String { get async throws }
}