Skip to content

Commit 9542216

Browse files
authored
Merge pull request #73188 from xedin/se-0428-renable-dist-protocol-macro-to-resolvable
[SE-0428] NFC: Rename `_DistributedProtocol` macro into `Resolvable`
2 parents 326f0f4 + e6b445b commit 9542216

10 files changed

+31
-31
lines changed

lib/Macros/Sources/SwiftMacros/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
add_swift_macro_library(SwiftMacros
1414
OptionSetMacro.swift
1515
DebugDescriptionMacro.swift
16-
DistributedProtocolMacro.swift
16+
DistributedResolvableMacro.swift
1717
SWIFT_DEPENDENCIES
1818
SwiftDiagnostics
1919
SwiftOperators

lib/Macros/Sources/SwiftMacros/DistributedProtocolMacro.swift renamed to lib/Macros/Sources/SwiftMacros/DistributedResolvableMacro.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import SwiftSyntaxBuilder
1818
/// Introduces:
1919
/// - `distributed actor $MyDistributedActor<ActorSystem>: $MyDistributedActor, _DistributedActorStub where ...`
2020
/// - `extension MyDistributedActor where Self: _DistributedActorStub {}`
21-
public struct DistributedProtocolMacro: ExtensionMacro, PeerMacro {
21+
public struct DistributedResolvableMacro: ExtensionMacro, PeerMacro {
2222
}
2323

2424
// ===== -----------------------------------------------------------------------
2525
// MARK: Default Stub implementations Extension
2626

27-
extension DistributedProtocolMacro {
27+
extension DistributedResolvableMacro {
2828

2929
/// Introduce the `extension MyDistributedActor` which contains default
3030
/// implementations of the protocol's requirements.
@@ -116,7 +116,7 @@ extension DistributedProtocolMacro {
116116
// ===== -----------------------------------------------------------------------
117117
// MARK: Distributed Actor Stub type
118118

119-
extension DistributedProtocolMacro {
119+
extension DistributedResolvableMacro {
120120

121121
/// Introduce the `distributed actor` stub type.
122122
public static func expansion(
@@ -263,9 +263,9 @@ extension DeclModifierSyntax {
263263
}
264264

265265
// ===== -----------------------------------------------------------------------
266-
// MARK: DistributedProtocol macro errors
266+
// MARK: @Distributed.Resolvable macro errors
267267

268-
extension DistributedProtocolMacro {
268+
extension DistributedResolvableMacro {
269269
static func throwIllegalTargetDecl(node: AttributeSyntax, _ declaration: some DeclSyntaxProtocol) throws -> Never {
270270
let kind: String
271271
if declaration.isClass {
@@ -282,11 +282,11 @@ extension DistributedProtocolMacro {
282282

283283
throw DiagnosticsError(
284284
syntax: node,
285-
message: "'@DistributedProtocol' can only be applied to 'protocol', but was attached to '\(kind)'", id: .invalidApplication)
285+
message: "'@Resolvable' can only be applied to 'protocol', but was attached to '\(kind)'", id: .invalidApplication)
286286
}
287287
}
288288

289-
struct DistributedProtocolMacroDiagnostic: DiagnosticMessage {
289+
struct DistributedResolvableMacroDiagnostic: DiagnosticMessage {
290290
enum ID: String {
291291
case invalidApplication = "invalid type"
292292
case missingInitializer = "missing initializer"
@@ -314,12 +314,12 @@ extension DiagnosticsError {
314314
syntax: S,
315315
message: String,
316316
domain: String = "Distributed",
317-
id: DistributedProtocolMacroDiagnostic.ID,
317+
id: DistributedResolvableMacroDiagnostic.ID,
318318
severity: SwiftDiagnostics.DiagnosticSeverity = .error) {
319319
self.init(diagnostics: [
320320
Diagnostic(
321321
node: Syntax(syntax),
322-
message: DistributedProtocolMacroDiagnostic(
322+
message: DistributedResolvableMacroDiagnostic(
323323
message: message,
324324
domain: domain,
325325
id: id,

stdlib/public/Distributed/DistributedMacros.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import _Concurrency
2828
/// in such way that the system's `SerializationRequirement` is statically known.
2929
@attached(peer, names: prefixed(`$`)) // provides $Greeter concrete stub type
3030
@attached(extension, names: arbitrary) // provides extension for Greeter & _DistributedActorStub
31-
public macro _DistributedProtocol() =
32-
#externalMacro(module: "SwiftMacros", type: "DistributedProtocolMacro")
31+
public macro Resolvable() =
32+
#externalMacro(module: "SwiftMacros", type: "DistributedResolvableMacro")
3333

3434
#endif

test/Distributed/Macros/distributed_macro_expansion_DistributedProtocol_errors.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@
1212

1313
import Distributed
1414

15-
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'struct' (from macro '_DistributedProtocol')}}
15+
@Resolvable // expected-error{{'@Resolvable' can only be applied to 'protocol', but was attached to 'struct' (from macro 'Resolvable')}}
1616
struct Struct {}
1717

18-
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'class' (from macro '_DistributedProtocol')}}
18+
@Resolvable // expected-error{{'@Resolvable' can only be applied to 'protocol', but was attached to 'class' (from macro 'Resolvable')}}
1919
class Clazz {}
2020

21-
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'actor' (from macro '_DistributedProtocol')}}
21+
@Resolvable // expected-error{{'@Resolvable' can only be applied to 'protocol', but was attached to 'actor' (from macro 'Resolvable')}}
2222
actor Act {}
2323

24-
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'actor' (from macro '_DistributedProtocol')}}
24+
@Resolvable // expected-error{{'@Resolvable' can only be applied to 'protocol', but was attached to 'actor' (from macro 'Resolvable')}}
2525
distributed actor Caplin {
2626
typealias ActorSystem = FakeActorSystem
2727
}
2828

29-
@_DistributedProtocol // expected-error{{Distributed protocol must declare actor system with SerializationRequirement}}
29+
@Resolvable // expected-error{{Distributed protocol must declare actor system with SerializationRequirement}}
3030
protocol Fail: DistributedActor {
3131
distributed func method() -> String
3232
}
3333

34-
@_DistributedProtocol // expected-note{{in expansion of macro '_DistributedProtocol' on protocol 'SomeRoot' here}}
34+
@Resolvable // expected-note{{in expansion of macro 'Resolvable' on protocol 'SomeRoot' here}}
3535
public protocol SomeRoot: DistributedActor, Sendable
3636
where ActorSystem: DistributedActorSystem<any Codable> {
3737

test/Distributed/Macros/distributed_macro_expansion_DistributedProtocol_inheritance.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Distributed
1313

1414
typealias System = LocalTestingDistributedActorSystem
1515

16-
@_DistributedProtocol
16+
@Resolvable
1717
protocol Base: DistributedActor where ActorSystem: DistributedActorSystem<any Codable> {
1818
distributed func base() -> Int
1919
}
@@ -35,7 +35,7 @@ protocol Base: DistributedActor where ActorSystem: DistributedActorSystem<any Co
3535

3636
// ==== ------------------------------------------------------------------------
3737

38-
@_DistributedProtocol
38+
@Resolvable
3939
protocol G3<ActorSystem>: DistributedActor, Base where ActorSystem: DistributedActorSystem<any Codable> {
4040
distributed func get() -> String
4141
distributed func greet(name: String) -> String

test/Distributed/Macros/distributed_macro_expansion_DistributedProtocol_simple.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
import Distributed
1313

14-
@_DistributedProtocol
14+
@Resolvable
1515
protocol Greeter: DistributedActor where ActorSystem: DistributedActorSystem<any Codable> {
1616
distributed func greet(name: String) -> String
1717
}
1818

19-
// @_DistributedProtocol ->
19+
// @Resolvable ->
2020

2121
// CHECK: distributed actor $Greeter<ActorSystem>: Greeter,
2222
// CHECK-NEXT: Distributed._DistributedActorStub
@@ -35,7 +35,7 @@ protocol Greeter: DistributedActor where ActorSystem: DistributedActorSystem<any
3535
// CHECK-NEXT: }
3636

3737
// Macro should be able to handle complex properties
38-
@_DistributedProtocol
38+
@Resolvable
3939
public protocol GetSet: DistributedActor, Sendable
4040
where ActorSystem: DistributedActorSystem<any Codable> {
4141

test/Distributed/Macros/distributed_macro_expansion_DistributedProtocol_various_requirements.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Distributed
1414

15-
@_DistributedProtocol
15+
@Resolvable
1616
protocol Greeter: DistributedActor where ActorSystem == FakeActorSystem {
1717
distributed func greet(name: String) -> String
1818
}
@@ -32,7 +32,7 @@ protocol Greeter: DistributedActor where ActorSystem == FakeActorSystem {
3232
// CHECK: }
3333
// CHECK: }
3434

35-
@_DistributedProtocol
35+
@Resolvable
3636
protocol Greeter2: DistributedActor where ActorSystem: DistributedActorSystem<any Codable> {
3737
distributed func greet(name: String) -> String
3838
}
@@ -57,7 +57,7 @@ extension String: CustomSerializationProtocol {
5757
public static func fromBytes(_ bytes: [UInt8]) throws -> Self { "" }
5858
}
5959

60-
@_DistributedProtocol
60+
@Resolvable
6161
protocol Greeter3: DistributedActor where ActorSystem: DistributedActorSystem<any CustomSerializationProtocol> {
6262
distributed func greet(name: String) -> String
6363
}
@@ -77,7 +77,7 @@ protocol Greeter3: DistributedActor where ActorSystem: DistributedActorSystem<an
7777
// CHECK: }
7878
// CHECK: }
7979

80-
@_DistributedProtocol
80+
@Resolvable
8181
public protocol Greeter4: DistributedActor where ActorSystem == FakeActorSystem {
8282
distributed func greet(name: String) -> String
8383
}
@@ -97,7 +97,7 @@ public protocol Greeter4: DistributedActor where ActorSystem == FakeActorSystem
9797
// CHECK: }
9898
// CHECK: }
9999

100-
@_DistributedProtocol
100+
@Resolvable
101101
public protocol GreeterMore: DistributedActor where ActorSystem == FakeActorSystem {
102102
distributed var name: String { get }
103103
distributed func greet(name: String) -> String

test/Distributed/Runtime/distributed_actor_localSystem_distributedProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import Distributed
2121

22-
@_DistributedProtocol
22+
@Resolvable
2323
@available(SwiftStdlib 6.0, *)
2424
protocol WorkerProtocol: DistributedActor where ActorSystem == LocalTestingDistributedActorSystem {
2525
distributed func distributedMethod() -> String

test/Distributed/Runtime/distributed_actor_remoteCall_protocol_method.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import FakeDistributedActorSystems
2020

2121
// ==== Known actor system -----------------------------------------------------
2222

23-
@_DistributedProtocol
23+
@Resolvable
2424
protocol GreeterDefinedSystemProtocol: DistributedActor where ActorSystem == FakeRoundtripActorSystem {
2525
distributed func greet() -> String
2626
}

test/Distributed/Runtime/distributed_actor_remoteCall_protocol_method_in_presence_of_multiple_systems.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import Distributed
1919
import FakeDistributedActorSystems
2020

21-
@_DistributedProtocol
21+
@Resolvable
2222
protocol GreeterProtocol: DistributedActor where ActorSystem: DistributedActorSystem<any Codable> {
2323
distributed func greet() -> String
2424
}

0 commit comments

Comments
 (0)