@@ -51,8 +51,8 @@ distributed actor Greeter {
51
51
. init( q: " question " , a: 42 , b: 1 , c: 2.0 , d: " Lorum ipsum " )
52
52
}
53
53
54
- distributed func echo( name: String ) -> String {
55
- return " Echo: \( name) "
54
+ distributed func echo( name: String , age : Int ) -> String {
55
+ return " Echo: name: \( name) , age: \( age ) "
56
56
}
57
57
58
58
distributed func enumResult( ) -> E {
@@ -117,12 +117,13 @@ struct FakeActorSystem: DistributedActorSystem {
117
117
struct FakeInvocation : DistributedTargetInvocationEncoder , DistributedTargetInvocationDecoder {
118
118
typealias SerializationRequirement = Codable
119
119
120
+ var substitutions : [ Any . Type ] = [ ]
120
121
var arguments : [ Any ] = [ ]
121
122
var returnType : Any . Type ? = nil
122
123
var errorType : Any . Type ? = nil
123
124
124
125
mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws {
125
- fatalError ( " NOT IMPLEMENTED: \( #function ) " )
126
+ substitutions . append ( type )
126
127
}
127
128
mutating func recordArgument< Argument: SerializationRequirement > ( _ argument: Argument ) throws {
128
129
arguments. append ( argument)
@@ -138,7 +139,7 @@ struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvo
138
139
// === Receiving / decoding -------------------------------------------------
139
140
140
141
func decodeGenericSubstitutions( ) throws -> [ Any . Type ] {
141
- [ ]
142
+ return substitutions
142
143
}
143
144
144
145
var argumentIndex : Int = 0
@@ -156,7 +157,7 @@ struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvo
156
157
}
157
158
158
159
print ( " > decode argument: \( argument) " )
159
- pointer. pointee = argument
160
+ pointer. initialize ( to : argument)
160
161
argumentIndex += 1
161
162
}
162
163
@@ -190,8 +191,7 @@ let helloName = "$s4main7GreeterC5helloSSyFTE"
190
191
let answerName = " $s4main7GreeterC6answerSiyFTE "
191
192
let largeResultName = " $s4main7GreeterC11largeResultAA11LargeStructVyFTE "
192
193
let enumResultName = " $s4main7GreeterC10enumResultAA1EOyFTE "
193
-
194
- let echoName = " $s4main7GreeterC4echo4nameS2S_tFTE "
194
+ let echoName = " $s4main7GreeterC4echo4name3ageS2S_SitFTE "
195
195
196
196
func test( ) async throws {
197
197
let system = FakeActorSystem ( )
@@ -243,14 +243,15 @@ func test() async throws {
243
243
244
244
var echoInvocation = system. makeInvocationEncoder ( )
245
245
try echoInvocation. recordArgument ( " Caplin " )
246
+ try echoInvocation. recordArgument ( 42 )
246
247
try echoInvocation. doneRecording ( )
247
248
try await system. executeDistributedTarget (
248
249
on: local,
249
250
mangledTargetName: echoName,
250
251
invocationDecoder: & echoInvocation,
251
252
handler: FakeResultHandler ( )
252
253
)
253
- // CHECK: RETURN: Echo: Caplin
254
+ // CHECK: RETURN: Echo: name: Caplin, age: 42
254
255
255
256
print ( " done " )
256
257
// CHECK-NEXT: done
0 commit comments