Skip to content

Commit 4c3fa03

Browse files
authored
[Distributed] Test for distributed protocols + method defaults (swiftlang#75609)
1 parent 71f010e commit 4c3fa03

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/Inputs/FakeDistributedActorSystems.swift
3+
// RUN: %target-swift-frontend -typecheck -verify -disable-availability-checking -I %t 2>&1 %s
4+
5+
// REQUIRES: concurrency
6+
// REQUIRES: distributed
7+
8+
import Distributed
9+
import FakeDistributedActorSystems
10+
11+
protocol Device: DistributedActor {
12+
distributed func fetch() async -> String?
13+
14+
distributed func fetch2() async -> String?
15+
distributed func fetch5() async -> String?
16+
}
17+
18+
distributed actor Impl: Device {
19+
typealias ActorSystem = FakeActorSystem
20+
21+
init(actorSystem: ActorSystem) {
22+
self.actorSystem = actorSystem
23+
}
24+
25+
// fetch() uses default impl
26+
27+
distributed func fetch2() async -> String? {
28+
""
29+
}
30+
31+
distributed func fetch5() async -> String? {
32+
""
33+
}
34+
}
35+
36+
// MARK: - Device default implementation
37+
38+
extension Device {
39+
distributed func fetch() async -> String? { "" }
40+
41+
distributed func fetch2() async -> String? { "" }
42+
distributed func fetch5() async -> String? { "" }
43+
}

0 commit comments

Comments
 (0)