1
1
// REQUIRES: VENDOR=apple
2
+ // REQUIRES: OS=macosx || OS=linux-gnu
2
3
// REQUIRES: concurrency
3
4
// REQUIRES: distributed
5
+ // UNSUPPORTED: use_os_stdlib
4
6
5
7
// RUN: %empty-directory(%t)
6
8
// RUN: split-file %s %t
7
9
8
10
// 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)
9
11
// 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
10
12
11
-
12
13
// RUN: %target-codesign %t/a.out
13
- // RUN: %target-run %t/a.out
14
+ // RUN: %target-run %t/a.out | %FileCheck %s
14
15
15
16
//--- library.swift
16
17
import Distributed
17
18
18
- //public protocol NormalProtocol {
19
- // func NORMAL() async -> Int
20
- //}
21
-
22
19
public protocol SimpleProtocol : DistributedActor
23
20
where ActorSystem == LocalTestingDistributedActorSystem {
24
21
@@ -32,35 +29,26 @@ public protocol SimpleProtocol: DistributedActor
32
29
import Distributed
33
30
import Library
34
31
35
- //actor NormalActor: NormalProtocol {
36
- // func NORMAL() async -> Int { 1 }
37
- //}
38
-
39
32
public 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
+ }
46
37
}
47
38
48
- // Fails
49
39
public func makeFromFail< Act: SimpleProtocol > ( _ act: Act ) async {
50
40
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
52
44
}
53
45
54
46
@main
55
47
struct TestSwiftFrameworkTests {
56
48
static func main( ) async {
57
49
let system = LocalTestingDistributedActorSystem ( )
58
50
59
- // let norm = NormalActor()
60
-
61
51
let simpleActor = SimpleActor ( actorSystem: system)
62
- // makeFromPass(simpleActor)
63
-
64
52
await makeFromFail ( simpleActor)
65
53
}
66
54
}
0 commit comments