mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Ensure that distributed functions with typed throws can be called from outside
When calling a distributed function for an actor that might not be local, the call can throw due to the distributed actor system producing an error. The function might, independently, also throw. When the function uses typed throws, we incorrectly treated the call is if it would always throw the error type specified by the function. This leads to incorrectly accepting invalid code, and compiler crashes in SILGen. The change here is to always mark calls to distributed functions outside the actor as "implicitly throwing", which makes sure that we treat the call sites as throwing 'any Error'. The actual handling of the typed throw (from the local function) and the untyped throw (from the distributed actor system) occurs in thunk generation in SILGen, and was already handled correctly. Fixes rdar://144093249, and undoes the ban introduced by rdar://136467528
This commit is contained in:
@@ -5656,9 +5656,6 @@ ERROR(distributed_actor_func_unsupported_specifier, none,
|
||||
ERROR(distributed_actor_func_variadic, none,
|
||||
"cannot declare variadic argument %0 in %kind1",
|
||||
(DeclName, const ValueDecl *))
|
||||
ERROR(distributed_actor_func_typed_throws, none,
|
||||
"cannot declare distributed function with typed throws",
|
||||
())
|
||||
NOTE(actor_mutable_state,none,
|
||||
"mutation of this %0 is only permitted within the actor",
|
||||
(DescriptiveDeclKind))
|
||||
|
||||
Reference in New Issue
Block a user