@@ -51,8 +51,8 @@ distributed actor Greeter {
5151 . init( q: " question " , a: 42 , b: 1 , c: 2.0 , d: " Lorum ipsum " )
5252 }
5353
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 ) "
5656 }
5757
5858 distributed func enumResult( ) -> E {
@@ -117,12 +117,13 @@ struct FakeActorSystem: DistributedActorSystem {
117117struct FakeInvocation : DistributedTargetInvocationEncoder , DistributedTargetInvocationDecoder {
118118 typealias SerializationRequirement = Codable
119119
120+ var substitutions : [ Any . Type ] = [ ]
120121 var arguments : [ Any ] = [ ]
121122 var returnType : Any . Type ? = nil
122123 var errorType : Any . Type ? = nil
123124
124125 mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws {
125- fatalError ( " NOT IMPLEMENTED: \( #function ) " )
126+ substitutions . append ( type )
126127 }
127128 mutating func recordArgument< Argument: SerializationRequirement > ( _ argument: Argument ) throws {
128129 arguments. append ( argument)
@@ -138,7 +139,7 @@ struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvo
138139 // === Receiving / decoding -------------------------------------------------
139140
140141 func decodeGenericSubstitutions( ) throws -> [ Any . Type ] {
141- [ ]
142+ return substitutions
142143 }
143144
144145 var argumentIndex : Int = 0
@@ -156,7 +157,7 @@ struct FakeInvocation: DistributedTargetInvocationEncoder, DistributedTargetInvo
156157 }
157158
158159 print ( " > decode argument: \( argument) " )
159- pointer. pointee = argument
160+ pointer. initialize ( to : argument)
160161 argumentIndex += 1
161162 }
162163
@@ -190,8 +191,7 @@ let helloName = "$s4main7GreeterC5helloSSyFTE"
190191let answerName = " $s4main7GreeterC6answerSiyFTE "
191192let largeResultName = " $s4main7GreeterC11largeResultAA11LargeStructVyFTE "
192193let enumResultName = " $s4main7GreeterC10enumResultAA1EOyFTE "
193-
194- let echoName = " $s4main7GreeterC4echo4nameS2S_tFTE "
194+ let echoName = " $s4main7GreeterC4echo4name3ageS2S_SitFTE "
195195
196196func test( ) async throws {
197197 let system = FakeActorSystem ( )
@@ -243,14 +243,15 @@ func test() async throws {
243243
244244 var echoInvocation = system. makeInvocationEncoder ( )
245245 try echoInvocation. recordArgument ( " Caplin " )
246+ try echoInvocation. recordArgument ( 42 )
246247 try echoInvocation. doneRecording ( )
247248 try await system. executeDistributedTarget (
248249 on: local,
249250 mangledTargetName: echoName,
250251 invocationDecoder: & echoInvocation,
251252 handler: FakeResultHandler ( )
252253 )
253- // CHECK: RETURN: Echo: Caplin
254+ // CHECK: RETURN: Echo: name: Caplin, age: 42
254255
255256 print ( " done " )
256257 // CHECK-NEXT: done
0 commit comments