File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1166,6 +1166,11 @@ AbstractFunctionDecl::isDistributedTargetInvocationResultHandlerOnReturn() const
1166
1166
return false ;
1167
1167
}
1168
1168
1169
+ // --- must not be mutating
1170
+ if (func->isMutating ()) {
1171
+ return false ;
1172
+ }
1173
+
1169
1174
// === Check generics
1170
1175
if (!isGeneric ()) {
1171
1176
return false ;
Original file line number Diff line number Diff line change @@ -816,6 +816,7 @@ struct BadResultHandler_missingOnReturn: DistributedTargetInvocationResultHandle
816
816
func onReturnVoid( ) async throws { }
817
817
func onThrow< Err: Error > ( error: Err ) async throws { }
818
818
}
819
+
819
820
struct BadResultHandler_missingRequirement : DistributedTargetInvocationResultHandler {
820
821
// expected-error@-1{{struct 'BadResultHandler_missingRequirement' is missing witness for protocol requirement 'onReturn'}}
821
822
// expected-note@-2{{protocol 'BadResultHandler_missingRequirement' requires function 'onReturn' with signature:}}
@@ -826,6 +827,16 @@ struct BadResultHandler_missingRequirement: DistributedTargetInvocationResultHan
826
827
func onThrow< Err: Error > ( error: Err ) async throws { }
827
828
}
828
829
830
+ struct BadResultHandler_mutatingButShouldNotBe : DistributedTargetInvocationResultHandler {
831
+ // expected-error@-1{{struct 'BadResultHandler_missingRequirement' is missing witness for protocol requirement 'onReturn'}}
832
+ // expected-note@-2{{protocol 'BadResultHandler_missingRequirement' requires function 'onReturn' with signature:}}
833
+ typealias SerializationRequirement = Codable
834
+
835
+ mutatign func onReturn< Success: Codable > ( value: Success ) async throws { } // WRONG: can't be mutating
836
+ func onReturnVoid( ) async throws { }
837
+ func onThrow< Err: Error > ( error: Err ) async throws { }
838
+ }
839
+
829
840
public struct PublicFakeResultHandler : DistributedTargetInvocationResultHandler {
830
841
public typealias SerializationRequirement = Codable
831
842
You can’t perform that action at this time.
0 commit comments