mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use the distributed thunk for non-distributed protocol requirements (#59513)
When a distributed-actor-isolated witness is provided for a non-distributed-actor-isolated requirement, always hop to the distributed thunk. While here, mark distributed thunks as being `final`, to ensure that we always statically call them vs. trying to retrieve them from the vtable (since they aren't in the vtable).
This commit is contained in:
@@ -699,6 +699,10 @@ static FuncDecl *createDistributedThunkFunction(FuncDecl *func) {
|
||||
func->getResultInterfaceType(), DC);
|
||||
thunk->setSynthesized(true);
|
||||
thunk->getAttrs().add(new (C) NonisolatedAttr(/*isImplicit=*/true));
|
||||
|
||||
if (isa<ClassDecl>(DC))
|
||||
thunk->getAttrs().add(new (C) FinalAttr(/*isImplicit=*/true));
|
||||
|
||||
thunk->setGenericSignature(baseSignature);
|
||||
thunk->copyFormalAccessFrom(func, /*sourceIsParentContext=*/false);
|
||||
thunk->setBodySynthesizer(deriveBodyDistributed_thunk, func);
|
||||
|
||||
Reference in New Issue
Block a user