10
10
11
11
import _Distributed
12
12
13
+ enum MyError : Error {
14
+ case test
15
+ }
16
+
13
17
@available ( SwiftStdlib 5 . 5 , * )
14
18
distributed actor PickATransport1 {
15
19
init ( kappa transport: ActorTransport , other: Int ) { }
@@ -36,6 +40,26 @@ distributed actor Bug_CallsReadyTwice {
36
40
}
37
41
}
38
42
43
+ @available ( SwiftStdlib 5 . 5 , * )
44
+ distributed actor Throwy {
45
+ init ( transport: ActorTransport , doThrow: Bool ) throws {
46
+ if doThrow {
47
+ throw MyError . test
48
+ }
49
+ }
50
+ }
51
+
52
+ @available ( SwiftStdlib 5 . 5 , * )
53
+ distributed actor ThrowBeforeFullyInit {
54
+ var x : Int
55
+ init ( transport: ActorTransport , doThrow: Bool ) throws {
56
+ if doThrow {
57
+ throw MyError . test
58
+ }
59
+ self . x = 0
60
+ }
61
+ }
62
+
39
63
// ==== Fake Transport ---------------------------------------------------------
40
64
41
65
@available ( SwiftStdlib 5 . 5 , * )
@@ -89,10 +113,27 @@ func test() async {
89
113
// CHECK: ready actor:main.PickATransport1, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
90
114
// CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
91
115
116
+ _ = try ? Throwy ( transport: transport, doThrow: false )
117
+ // CHECK: assign type:Throwy, id:ActorAddress(address: "[[ID:.*]]")
118
+ // CHECK: ready actor:main.Throwy, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
119
+ // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
120
+
121
+ _ = try ? Throwy ( transport: transport, doThrow: true )
122
+ // CHECK: assign type:Throwy, id:ActorAddress(address: "[[ID:.*]]")
123
+ // CHECK-NOT: ready
124
+ // CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
125
+
126
+ _ = try ? ThrowBeforeFullyInit ( transport: transport, doThrow: true )
127
+ // CHECK: assign type:ThrowBeforeFullyInit, id:ActorAddress(address: "[[ID:.*]]")
128
+ // FIXME: The two checks below should work, but do not currently, so they're disabled (rdar://84533820).
129
+ // MISSING-CHECK-NOT: ready actor:main.ThrowBeforeFullyInit
130
+ // MISSING-CHECK: resign id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
131
+
92
132
_ = await PickATransport2 ( other: 1 , theTransport: transport)
93
133
// CHECK: assign type:PickATransport2, id:ActorAddress(address: "[[ID:.*]]")
94
134
// CHECK: ready actor:main.PickATransport2, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
95
135
136
+ // FIXME: The checks for this initializer should NOT pass, but currently do. (rdar://84533820)
96
137
_ = await Bug_CallsReadyTwice ( transport: transport, wantBug: true )
97
138
// CHECK: assign type:Bug_CallsReadyTwice, id:ActorAddress(address: "[[ID:.*]]")
98
139
// CHECK: ready actor:main.Bug_CallsReadyTwice, id:AnyActorIdentity(ActorAddress(address: "[[ID]]"))
0 commit comments