@@ -8,10 +8,10 @@ import Distributed
8
8
9
9
struct MissingRemoteCall : DistributedActorSystem {
10
10
// expected-error@-1{{struct 'MissingRemoteCall' is missing witness for protocol requirement 'remoteCall'}}
11
- // expected-note@-2{{protocol 'MissingRemoteCall ' requires function 'remoteCall' with signature:}}
11
+ // expected-note@-2{{protocol 'DistributedActorSystem ' requires function 'remoteCall' with signature:}}
12
12
13
13
// expected-error@-4{{struct 'MissingRemoteCall' is missing witness for protocol requirement 'remoteCallVoid'}}
14
- // expected-note@-5{{protocol 'MissingRemoteCall ' requires function 'remoteCallVoid' with signature:}}
14
+ // expected-note@-5{{protocol 'DistributedActorSystem ' requires function 'remoteCallVoid' with signature:}}
15
15
16
16
typealias ActorID = ActorAddress
17
17
typealias InvocationDecoder = FakeInvocationDecoder
@@ -41,12 +41,73 @@ struct MissingRemoteCall: DistributedActorSystem {
41
41
}
42
42
}
43
43
44
+ struct RemoteCallMutating : DistributedActorSystem {
45
+ // expected-error@-1{{struct 'RemoteCallMutating' is missing witness for protocol requirement 'remoteCall'}}
46
+ // expected-note@-2{{protocol 'DistributedActorSystem' requires function 'remoteCall' with signature:}}
47
+
48
+ // expected-error@-4{{struct 'RemoteCallMutating' is missing witness for protocol requirement 'remoteCallVoid'}}
49
+ // expected-note@-5{{protocol 'DistributedActorSystem' requires function 'remoteCallVoid' with signature:}}
50
+
51
+ typealias ActorID = ActorAddress
52
+ typealias InvocationDecoder = FakeInvocationDecoder
53
+ typealias InvocationEncoder = FakeInvocationEncoder
54
+ typealias SerializationRequirement = Codable
55
+ typealias ResultHandler = FakeResultHandler
56
+
57
+ func resolve< Act> ( id: ActorID , as actorType: Act . Type )
58
+ throws -> Act ? where Act: DistributedActor {
59
+ return nil
60
+ }
61
+
62
+ func assignID< Act> ( _ actorType: Act . Type ) -> ActorID
63
+ where Act: DistributedActor {
64
+ ActorAddress ( parse: " fake://123 " )
65
+ }
66
+
67
+ func actorReady< Act> ( _ actor : Act )
68
+ where Act: DistributedActor ,
69
+ Act. ID == ActorID {
70
+ }
71
+
72
+ func resignID( _ id: ActorID ) {
73
+ }
74
+
75
+ mutating func remoteCall< Act, Err, Res> (
76
+ on actor : Act ,
77
+ target: RemoteCallTarget ,
78
+ invocation: inout InvocationEncoder ,
79
+ throwing: Err . Type ,
80
+ returning: Res . Type
81
+ ) async throws -> Res
82
+ where Act: DistributedActor ,
83
+ Act. ID == ActorID ,
84
+ Err: Error ,
85
+ Res: SerializationRequirement {
86
+ fatalError ( " NOT IMPLEMENTED \( #function) " )
87
+ }
88
+
89
+ mutating func remoteCallVoid< Act, Err> (
90
+ on actor : Act ,
91
+ target: RemoteCallTarget ,
92
+ invocation: inout InvocationEncoder ,
93
+ throwing: Err . Type
94
+ ) async throws
95
+ where Act: DistributedActor ,
96
+ Act. ID == ActorID ,
97
+ Err: Error {
98
+ fatalError ( " NOT IMPLEMENTED \( #function) " )
99
+ }
100
+
101
+ func makeInvocationEncoder( ) -> InvocationEncoder {
102
+ }
103
+ }
104
+
44
105
struct MissingRemoteCall_missingInout_on_encoder : DistributedActorSystem {
45
106
// expected-error@-1{{struct 'MissingRemoteCall_missingInout_on_encoder' is missing witness for protocol requirement 'remoteCall'}}
46
- // expected-note@-2{{protocol 'MissingRemoteCall_missingInout_on_encoder ' requires function 'remoteCall' with signature:}}
107
+ // expected-note@-2{{protocol 'DistributedActorSystem ' requires function 'remoteCall' with signature:}}
47
108
48
109
// expected-error@-4{{struct 'MissingRemoteCall_missingInout_on_encoder' is missing witness for protocol requirement 'remoteCallVoid'}}
49
- // expected-note@-5{{protocol 'MissingRemoteCall_missingInout_on_encoder ' requires function 'remoteCallVoid' with signature:}}
110
+ // expected-note@-5{{protocol 'DistributedActorSystem ' requires function 'remoteCallVoid' with signature:}}
50
111
51
112
typealias ActorID = ActorAddress
52
113
typealias InvocationDecoder = FakeInvocationDecoder
@@ -160,10 +221,10 @@ struct MissingRemoteCall_missing_makeInvocationEncoder: DistributedActorSystem {
160
221
161
222
struct Error_wrongReturn : DistributedActorSystem {
162
223
// expected-error@-1{{struct 'Error_wrongReturn' is missing witness for protocol requirement 'remoteCall'}}
163
- // expected-note@-2{{protocol 'Error_wrongReturn ' requires function 'remoteCall' with signature:}}
224
+ // expected-note@-2{{protocol 'DistributedActorSystem ' requires function 'remoteCall' with signature:}}
164
225
165
226
// expected-error@-4{{struct 'Error_wrongReturn' is missing witness for protocol requirement 'remoteCallVoid'}}
166
- // expected-note@-5{{protocol 'Error_wrongReturn ' requires function 'remoteCallVoid' with signature:}}
227
+ // expected-note@-5{{protocol 'DistributedActorSystem ' requires function 'remoteCallVoid' with signature:}}
167
228
168
229
typealias ActorID = ActorAddress
169
230
typealias InvocationDecoder = FakeInvocationDecoder
@@ -235,10 +296,10 @@ struct Error_wrongReturn: DistributedActorSystem {
235
296
236
297
struct BadRemoteCall_param : DistributedActorSystem {
237
298
// expected-error@-1{{struct 'BadRemoteCall_param' is missing witness for protocol requirement 'remoteCall'}}
238
- // expected-note@-2{{protocol 'BadRemoteCall_param ' requires function 'remoteCall' with signature:}}
299
+ // expected-note@-2{{protocol 'DistributedActorSystem ' requires function 'remoteCall' with signature:}}
239
300
240
301
// expected-error@-4{{struct 'BadRemoteCall_param' is missing witness for protocol requirement 'remoteCallVoid'}}
241
- // expected-note@-5{{protocol 'BadRemoteCall_param ' requires function 'remoteCallVoid' with signature:}}
302
+ // expected-note@-5{{protocol 'DistributedActorSystem ' requires function 'remoteCallVoid' with signature:}}
242
303
243
304
typealias ActorID = ActorAddress
244
305
typealias InvocationDecoder = FakeInvocationDecoder
@@ -345,7 +406,7 @@ public struct BadRemoteCall_notPublic: DistributedActorSystem {
345
406
346
407
public struct BadRemoteCall_badResultConformance : DistributedActorSystem {
347
408
// expected-error@-1{{struct 'BadRemoteCall_badResultConformance' is missing witness for protocol requirement 'remoteCall'}}
348
- // expected-note@-2{{protocol 'BadRemoteCall_badResultConformance ' requires function 'remoteCall' with signature:}}
409
+ // expected-note@-2{{protocol 'DistributedActorSystem ' requires function 'remoteCall' with signature:}}
349
410
350
411
public typealias ActorID = ActorAddress
351
412
public typealias InvocationDecoder = PublicFakeInvocationDecoder
@@ -452,7 +513,7 @@ struct BadRemoteCall_largeSerializationRequirement: DistributedActorSystem {
452
513
453
514
struct BadRemoteCall_largeSerializationRequirementSlightlyOffInDefinition : DistributedActorSystem {
454
515
// expected-error@-1{{struct 'BadRemoteCall_largeSerializationRequirementSlightlyOffInDefinition' is missing witness for protocol requirement 'remoteCall'}}
455
- // expected-note@-2{{protocol 'BadRemoteCall_largeSerializationRequirementSlightlyOffInDefinition ' requires function 'remoteCall' with signature:}}
516
+ // expected-note@-2{{protocol 'DistributedActorSystem ' requires function 'remoteCall' with signature:}}
456
517
457
518
typealias ActorID = ActorAddress
458
519
typealias InvocationDecoder = LargeSerializationReqFakeInvocationDecoder
@@ -608,7 +669,7 @@ public struct PublicFakeInvocationEncoder: DistributedTargetInvocationEncoder {
608
669
609
670
struct FakeInvocationEncoder_missing_recordArgument : DistributedTargetInvocationEncoder {
610
671
//expected-error@-1{{struct 'FakeInvocationEncoder_missing_recordArgument' is missing witness for protocol requirement 'recordArgument'}}
611
- //expected-note@-2{{protocol 'FakeInvocationEncoder_missing_recordArgument ' requires function 'recordArgument' with signature:}}
672
+ //expected-note@-2{{protocol 'DistributedTargetInvocationEncoder ' requires function 'recordArgument' with signature:}}
612
673
typealias SerializationRequirement = Codable
613
674
614
675
mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws { }
@@ -620,7 +681,7 @@ struct FakeInvocationEncoder_missing_recordArgument: DistributedTargetInvocation
620
681
621
682
struct FakeInvocationEncoder_missing_recordArgument2 : DistributedTargetInvocationEncoder {
622
683
//expected-error@-1{{struct 'FakeInvocationEncoder_missing_recordArgument2' is missing witness for protocol requirement 'recordArgument'}}
623
- //expected-note@-2{{protocol 'FakeInvocationEncoder_missing_recordArgument2 ' requires function 'recordArgument' with signature:}}
684
+ //expected-note@-2{{protocol 'DistributedTargetInvocationEncoder ' requires function 'recordArgument' with signature:}}
624
685
typealias SerializationRequirement = Codable
625
686
626
687
mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws { }
@@ -632,7 +693,7 @@ struct FakeInvocationEncoder_missing_recordArgument2: DistributedTargetInvocatio
632
693
633
694
struct FakeInvocationEncoder_missing_recordReturnType : DistributedTargetInvocationEncoder {
634
695
//expected-error@-1{{struct 'FakeInvocationEncoder_missing_recordReturnType' is missing witness for protocol requirement 'recordReturnType'}}
635
- //expected-note@-2{{protocol 'FakeInvocationEncoder_missing_recordReturnType ' requires function 'recordReturnType' with signature:}}
696
+ //expected-note@-2{{protocol 'DistributedTargetInvocationEncoder ' requires function 'recordReturnType' with signature:}}
636
697
typealias SerializationRequirement = Codable
637
698
638
699
mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws { }
@@ -655,7 +716,7 @@ struct FakeInvocationEncoder_missing_recordErrorType: DistributedTargetInvocatio
655
716
656
717
struct FakeInvocationEncoder_recordArgument_wrongType : DistributedTargetInvocationEncoder {
657
718
//expected-error@-1{{struct 'FakeInvocationEncoder_recordArgument_wrongType' is missing witness for protocol requirement 'recordArgument'}}
658
- //expected-note@-2{{protocol 'FakeInvocationEncoder_recordArgument_wrongType ' requires function 'recordArgument' with signature:}}
719
+ //expected-note@-2{{protocol 'DistributedTargetInvocationEncoder ' requires function 'recordArgument' with signature:}}
659
720
typealias SerializationRequirement = Codable
660
721
661
722
mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws { }
@@ -668,7 +729,7 @@ struct FakeInvocationEncoder_recordArgument_wrongType: DistributedTargetInvocati
668
729
}
669
730
struct FakeInvocationEncoder_recordArgument_missingMutating : DistributedTargetInvocationEncoder {
670
731
//expected-error@-1{{struct 'FakeInvocationEncoder_recordArgument_missingMutating' is missing witness for protocol requirement 'recordArgument'}}
671
- //expected-note@-2{{protocol 'FakeInvocationEncoder_recordArgument_missingMutating ' requires function 'recordArgument' with signature:}}
732
+ //expected-note@-2{{protocol 'DistributedTargetInvocationEncoder ' requires function 'recordArgument' with signature:}}
672
733
typealias SerializationRequirement = Codable
673
734
674
735
mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws { }
@@ -680,7 +741,7 @@ struct FakeInvocationEncoder_recordArgument_missingMutating: DistributedTargetIn
680
741
681
742
struct FakeInvocationEncoder_recordResultType_wrongType : DistributedTargetInvocationEncoder {
682
743
//expected-error@-1{{struct 'FakeInvocationEncoder_recordResultType_wrongType' is missing witness for protocol requirement 'recordReturnType'}}
683
- //expected-note@-2{{protocol 'FakeInvocationEncoder_recordResultType_wrongType ' requires function 'recordReturnType' with signature:}}
744
+ //expected-note@-2{{protocol 'DistributedTargetInvocationEncoder ' requires function 'recordReturnType' with signature:}}
684
745
typealias SerializationRequirement = Codable
685
746
686
747
mutating func recordGenericSubstitution< T> ( _ type: T . Type ) throws { }
@@ -757,7 +818,7 @@ public final class PublicFakeInvocationDecoder_badNotPublic: DistributedTargetIn
757
818
758
819
final class PublicFakeInvocationDecoder_badBadProtoRequirement : DistributedTargetInvocationDecoder {
759
820
// expected-error@-1{{class 'PublicFakeInvocationDecoder_badBadProtoRequirement' is missing witness for protocol requirement 'decodeNextArgument'}}
760
- // expected-note@-2{{protocol 'PublicFakeInvocationDecoder_badBadProtoRequirement ' requires function 'decodeNextArgument' with signature:}}
821
+ // expected-note@-2{{protocol 'DistributedTargetInvocationDecoder ' requires function 'decodeNextArgument' with signature:}}
761
822
typealias SerializationRequirement = Codable
762
823
763
824
func decodeGenericSubstitutions( ) throws -> [ Any . Type ] { [ ] }
@@ -809,23 +870,34 @@ struct LargeSerializationReqFakeInvocationResultHandler: DistributedTargetInvoca
809
870
810
871
struct BadResultHandler_missingOnReturn : DistributedTargetInvocationResultHandler {
811
872
// expected-error@-1{{struct 'BadResultHandler_missingOnReturn' is missing witness for protocol requirement 'onReturn'}}
812
- // expected-note@-2{{protocol 'BadResultHandler_missingOnReturn ' requires function 'onReturn' with signature:}}
873
+ // expected-note@-2{{protocol 'DistributedTargetInvocationResultHandler ' requires function 'onReturn' with signature:}}
813
874
typealias SerializationRequirement = Codable
814
875
815
876
// func onReturn<Res: SerializationRequirement>(value: Res) async throws {} // MISSING
816
877
func onReturnVoid( ) async throws { }
817
878
func onThrow< Err: Error > ( error: Err ) async throws { }
818
879
}
880
+
819
881
struct BadResultHandler_missingRequirement : DistributedTargetInvocationResultHandler {
820
882
// expected-error@-1{{struct 'BadResultHandler_missingRequirement' is missing witness for protocol requirement 'onReturn'}}
821
- // expected-note@-2{{protocol 'BadResultHandler_missingRequirement ' requires function 'onReturn' with signature:}}
883
+ // expected-note@-2{{protocol 'DistributedTargetInvocationResultHandler ' requires function 'onReturn' with signature:}}
822
884
typealias SerializationRequirement = Codable
823
885
824
886
func onReturn< Success> ( value: Success ) async throws { } // MISSING : Codable
825
887
func onReturnVoid( ) async throws { }
826
888
func onThrow< Err: Error > ( error: Err ) async throws { }
827
889
}
828
890
891
+ struct BadResultHandler_mutatingButShouldNotBe : DistributedTargetInvocationResultHandler {
892
+ // expected-error@-1{{struct 'BadResultHandler_mutatingButShouldNotBe' is missing witness for protocol requirement 'onReturn'}}
893
+ // expected-note@-2{{protocol 'DistributedTargetInvocationResultHandler' requires function 'onReturn' with signature:}}
894
+ typealias SerializationRequirement = Codable
895
+
896
+ mutating func onReturn< Success: Codable > ( value: Success ) async throws { } // WRONG: can't be mutating
897
+ func onReturnVoid( ) async throws { }
898
+ func onThrow< Err: Error > ( error: Err ) async throws { }
899
+ }
900
+
829
901
public struct PublicFakeResultHandler : DistributedTargetInvocationResultHandler {
830
902
public typealias SerializationRequirement = Codable
831
903
0 commit comments