Skip to content

Commit 9289d08

Browse files
authored
Merge pull request swiftlang#38914 from ktoso/wip-enable-runtime-tests-again
[Distributed] Re-enable runtime tests
2 parents f458d9b + d5a2344 commit 9289d08

16 files changed

+42
-64
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4459,10 +4459,10 @@ NOTE(actor_isolated_sync_func,none,
44594459
"implicitly asynchronous",
44604460
(DescriptiveDeclKind, DeclName))
44614461
NOTE(distributed_actor_isolated_method_note,none,
4462-
"only 'distributed' functions can be called from outside the distributed actor", // TODO: improve error message
4462+
"only 'distributed' functions can be called from outside the distributed actor", // TODO(distributed): improve error message
44634463
())
44644464
ERROR(distributed_actor_isolated_method,none,
4465-
"only 'distributed' functions can be called from outside the distributed actor", // TODO: improve error message to be more like 'non-distributed' ... defined here
4465+
"only 'distributed' functions can be called from outside the distributed actor", // TODO(distributed): improve error message to be more like 'non-distributed' ... defined here
44664466
())
44674467
ERROR(distributed_actor_func_param_not_codable,none,
44684468
"distributed function parameter '%0' of type %1 does not conform to 'Codable'",

lib/Sema/CodeSynthesisDistributedActor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ AbstractFunctionDecl *TypeChecker::addImplicitDistributedActorRemoteFunction(
175175
// nonisolated
176176
remoteFuncDecl->getAttrs().add(new (C) NonisolatedAttr(/*IsImplicit=*/true));
177177

178+
// nonisolated
179+
remoteFuncDecl->getAttrs().add(
180+
new (C) NonisolatedAttr(/*IsImplicit=*/true));
181+
178182
// users should never have to access this function directly;
179183
// it is only invoked from our distributed function thunk if the actor is remote.
180184
remoteFuncDecl->setUserAccessible(false);

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ namespace {
13841384
decl->diagnose(diag::distributed_actor_isolated_method_note);
13851385
}
13861386
} else if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
1387-
func->diagnose(diag::actor_isolated_sync_func, // FIXME: this is emitted wrongly for self.hello()
1387+
func->diagnose(diag::actor_isolated_sync_func,
13881388
decl->getDescriptiveKind(),
13891389
decl->getName());
13901390

test/Distributed/Runtime/distributed_actor_deinit.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
import _Distributed
1414

1515
@available(SwiftStdlib 5.5, *)
16-
actor A {}
16+
actor A {}
1717

1818
@available(SwiftStdlib 5.5, *)
1919
distributed actor DA {
2020
init(transport: ActorTransport) {
21-
defer { transport.actorReady(self) }
21+
defer { transport.actorReady(self) } // FIXME(distributed): rdar://81783599 this should be injected automatically
2222
}
2323
}
2424

2525
@available(SwiftStdlib 5.5, *)
2626
distributed actor DA_userDefined {
2727
init(transport: ActorTransport) {
28-
defer { transport.actorReady(self) }
28+
defer { transport.actorReady(self) } // FIXME(distributed): rdar://81783599 this should be injected automatically
2929
}
3030

3131
deinit {}
@@ -34,7 +34,7 @@ distributed actor DA_userDefined {
3434
@available(SwiftStdlib 5.5, *)
3535
distributed actor DA_userDefined2 {
3636
init(transport: ActorTransport) {
37-
defer { transport.actorReady(self) }
37+
defer { transport.actorReady(self) } // FIXME(distributed): rdar://81783599 this should be injected automatically
3838
}
3939

4040
deinit {
@@ -49,7 +49,7 @@ distributed actor DA_state {
4949
var age = 42
5050

5151
init(transport: ActorTransport) {
52-
defer { transport.actorReady(self) }
52+
defer { transport.actorReady(self) } // FIXME(distributed): rdar://81783599 this should be injected automatically
5353
}
5454

5555
deinit {

test/Distributed/Runtime/distributed_actor_dynamic_remote_func.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@
77
// UNSUPPORTED: use_os_stdlib
88
// UNSUPPORTED: back_deployment_runtime
99

10-
// REQUIRES: rdar78290608
10+
// FIXME(distributed): remote functions dont seem to work on windows?
11+
// XFAIL: OS=windows-msvc
1112

1213
import _Distributed
1314

1415
@available(SwiftStdlib 5.5, *)
1516
distributed actor LocalWorker {
17+
init(transport: ActorTransport) {
18+
defer { transport.actorReady(self) } // FIXME(distributed): rdar://81783599 this should be injected automatically
19+
}
20+
1621
distributed func function() async throws -> String {
1722
"local:"
1823
}
@@ -25,13 +30,13 @@ distributed actor LocalWorker {
2530
@available(SwiftStdlib 5.5, *)
2631
extension LocalWorker {
2732
@_dynamicReplacement(for: _remote_function())
28-
// TODO: @_remoteDynamicReplacement(for: function()) - could be a nicer spelling, hiding that we use dynamic under the covers
33+
// TODO(distributed): @_remoteDynamicReplacement(for: function()) - could be a nicer spelling, hiding that we use dynamic under the covers
2934
func _cluster_remote_function() async throws -> String {
3035
"\(#function):"
3136
}
3237

3338
@_dynamicReplacement(for: _remote_echo(name:))
34-
// TODO: @_remoteDynamicReplacement(for: hello(name:)) - could be a nicer spelling, hiding that we use dynamic under the covers
39+
// TODO(distributed): @_remoteDynamicReplacement(for: hello(name:)) - could be a nicer spelling, hiding that we use dynamic under the covers
3540
func _cluster_remote_echo(name: String) async throws -> String {
3641
"\(#function):\(name)"
3742
}
@@ -95,7 +100,7 @@ func test_remote() async throws {
95100
let address = ActorAddress(parse: "")
96101
let transport = FakeTransport()
97102

98-
let worker = try LocalWorkerresolve(.init(address), using: transport)
103+
let worker = try LocalWorker.resolve(.init(address), using: transport)
99104
let x = try await worker.function()
100105
print("call: \(x)")
101106
// CHECK: call: _cluster_remote_function():

test/Distributed/Runtime/distributed_actor_init_local.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// UNSUPPORTED: use_os_stdlib
99
// UNSUPPORTED: back_deployment_runtime
1010

11-
// REQUIRES: rdar78290608
12-
1311
import _Distributed
1412

1513
@available(SwiftStdlib 5.5, *)

test/Distributed/Runtime/distributed_actor_isRemote.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// UNSUPPORTED: use_os_stdlib
99
// UNSUPPORTED: back_deployment_runtime
1010

11-
// REQUIRES: rdar78290608
11+
// FIXME(distributed): remote functions dont seem to work on windows?
12+
// XFAIL: OS=windows-msvc
1213

1314
import _Distributed
1415

test/Distributed/Runtime/distributed_actor_local.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
// REQUIRES: concurrency
55
// REQUIRES: distributed
66

7+
// rdar://83859906
8+
// UNSUPPORTED: OS=windows-msvc
9+
10+
711
// rdar://76038845
812
// UNSUPPORTED: use_os_stdlib
913
// UNSUPPORTED: back_deployment_runtime
1014

11-
// REQUIRES: rdar78290608
12-
1315
import _Distributed
1416

1517
@available(SwiftStdlib 5.5, *)

test/Distributed/Runtime/distributed_actor_remote_fieldsDontCrashDeinit.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// UNSUPPORTED: use_os_stdlib
99
// UNSUPPORTED: back_deployment_runtime
1010

11-
1211
import _Distributed
1312

1413
@available(SwiftStdlib 5.5, *)

test/Distributed/Runtime/distributed_actor_remote_functions.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,9 @@ struct FakeTransport: ActorTransport {
149149
fatalError("not implemented:\(#function)")
150150
}
151151

152-
func resolve<Act>(_ identity: AnyActorIdentity, as actorType: Act.Type)
153-
throws -> Act?
152+
func resolve<Act>(_ identity: AnyActorIdentity, as actorType: Act.Type) throws -> Act?
154153
where Act: DistributedActor {
155-
return nil
154+
nil
156155
}
157156

158157
func assignIdentity<Act>(_ actorType: Act.Type) -> AnyActorIdentity

0 commit comments

Comments
 (0)