11// REQUIRES: VENDOR=apple
2+ // REQUIRES: OS=macosx || OS=linux-gnu
23// REQUIRES: concurrency
34// REQUIRES: distributed
5+ // UNSUPPORTED: use_os_stdlib
46
57// RUN: %empty-directory(%t)
68// RUN: split-file %s %t
79
810// RUN: %target-build-swift -Xfrontend -validate-tbd-against-ir=all -enable-library-evolution -target %target-cpu-apple-macosx13.0 -parse-as-library -emit-library -emit-module-path %t/Library.swiftmodule -module-name Library %t/library.swift -o %t/%target-library-name(Library)
911// RUN: %target-build-swift -Xfrontend -validate-tbd-against-ir=all -target %target-cpu-apple-macosx13.0 -parse-as-library -lLibrary -module-name main -I %t -L %t %t/main.swift -o %t/a.out
1012
11-
1213// RUN: %target-codesign %t/a.out
13- // RUN: %target-run %t/a.out
14+ // RUN: %target-run %t/a.out | %FileCheck %s
1415
1516//--- library.swift
1617import Distributed
1718
18- //public protocol NormalProtocol {
19- // func NORMAL() async -> Int
20- //}
21-
2219public protocol SimpleProtocol : DistributedActor
2320 where ActorSystem == LocalTestingDistributedActorSystem {
2421
@@ -32,35 +29,26 @@ public protocol SimpleProtocol: DistributedActor
3229import Distributed
3330import Library
3431
35- //actor NormalActor: NormalProtocol {
36- // func NORMAL() async -> Int { 1 }
37- //}
38-
3932public distributed actor SimpleActor : SimpleProtocol {
40- public distributed func test( ) -> Int { 1 }
41- }
42-
43- // Passes
44- public func makeFromPass< Act: DistributedActor > ( _ act: Act ) {
45- print ( act. id)
33+ public distributed func test( ) -> Int {
34+ print ( " SimpleActor.test " )
35+ return 1
36+ }
4637}
4738
48- // Fails
4939public func makeFromFail< Act: SimpleProtocol > ( _ act: Act ) async {
5040 print ( act. id)
51- try ! await print ( act. test ( ) )
41+ try ! await print ( " act.test() = \( act. test ( ) ) " )
42+ // CHECK: SimpleActor.test
43+ // CHECK: act.test() = 1
5244}
5345
5446@main
5547struct TestSwiftFrameworkTests {
5648 static func main( ) async {
5749 let system = LocalTestingDistributedActorSystem ( )
5850
59- // let norm = NormalActor()
60-
6151 let simpleActor = SimpleActor ( actorSystem: system)
62- // makeFromPass(simpleActor)
63-
6452 await makeFromFail ( simpleActor)
6553 }
6654}
0 commit comments