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
11661166 return false ;
11671167 }
11681168
1169+ // --- must not be mutating
1170+ if (func->isMutating ()) {
1171+ return false ;
1172+ }
1173+
11691174 // === Check generics
11701175 if (!isGeneric ()) {
11711176 return false ;
Original file line number Diff line number Diff line change @@ -816,6 +816,7 @@ struct BadResultHandler_missingOnReturn: DistributedTargetInvocationResultHandle
816816 func onReturnVoid( ) async throws { }
817817 func onThrow< Err: Error > ( error: Err ) async throws { }
818818}
819+
819820struct BadResultHandler_missingRequirement : DistributedTargetInvocationResultHandler {
820821 // expected-error@-1{{struct 'BadResultHandler_missingRequirement' is missing witness for protocol requirement 'onReturn'}}
821822 // expected-note@-2{{protocol 'BadResultHandler_missingRequirement' requires function 'onReturn' with signature:}}
@@ -826,6 +827,16 @@ struct BadResultHandler_missingRequirement: DistributedTargetInvocationResultHan
826827 func onThrow< Err: Error > ( error: Err ) async throws { }
827828}
828829
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+ mutating 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+
829840public struct PublicFakeResultHandler : DistributedTargetInvocationResultHandler {
830841 public typealias SerializationRequirement = Codable
831842
You can’t perform that action at this time.
0 commit comments