Skip to content

Commit 8b03686

Browse files
committed
[Distributed] improve simple test to be testing more of extension isolation
1 parent d66eeae commit 8b03686

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/Distributed/distributed_actor_protocol_isolation.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// 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-emit-module -I %t -emit-module-path %t/distributed_actor_protocol_isolation.swiftmodule -module-name distributed_actor_protocol_isolation -disable-availability-checking %s
4-
// X: %target-swift-frontend -typecheck -verify -disable-availability-checking -I %t 2>&1 %s
3+
// RUN: %target-swift-frontend -typecheck -verify -disable-availability-checking -I %t 2>&1 %s
54
// REQUIRES: concurrency
65
// REQUIRES: distributed
76

@@ -15,7 +14,7 @@ protocol Greeting: DistributedActor {
1514
}
1615

1716
extension Greeting {
18-
func greetLocal(name: String) {
17+
func greetLocal(name: String) { // expected-note{{distributed actor-isolated instance method 'greetLocal(name:)' declared here}}
1918
print("\(greeting()), \(name)!") // okay, we're on the actor
2019
}
2120
}
@@ -28,10 +27,12 @@ extension Greeting where SerializationRequirement == Codable {
2827
}
2928
}
3029

31-
extension Greeting {
30+
extension Greeting where Self.SerializationRequirement == Codable {
3231
nonisolated func greetAliceALot() async throws {
33-
// try await greetDistributed(name: "Alice") // okay, via Codable
34-
// let rawGreeting = try await greeting() // okay, via Self's serialization requirement
35-
// greetLocal(name: "Alice") // expected-error{{only 'distributed' instance methods can be called on a potentially remote distributed actor}}
32+
try await self.greetDistributed(name: "Alice") // okay, via Codable
33+
let rawGreeting = try await greeting() // okay, via Self's serialization requirement
34+
_ = rawGreeting
35+
36+
greetLocal(name: "Alice") // expected-error{{only 'distributed' instance methods can be called on a potentially remote distributed actor}}
3637
}
3738
}

0 commit comments

Comments
 (0)