Skip to content

Commit 39b81ac

Browse files
committed
[AST] Handle generic actor system when trying to produce a ref to decodeNextArgument
1 parent 65d164a commit 39b81ac

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lib/AST/DistributedDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ swift::getAssociatedDistributedInvocationDecoderDecodeNextArgumentFunction(
256256
return nullptr;
257257

258258
auto systemTy = getConcreteReplacementForProtocolActorSystemType(thunk);
259-
if (!systemTy)
259+
if (!systemTy || systemTy->is<GenericTypeParamType>())
260260
return nullptr;
261261

262262
auto decoderTy =

lib/SIL/IR/SILFunctionBuilder.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,15 @@ void SILFunctionBuilder::addFunctionAttributes(
275275
F->setDynamicallyReplacedFunction(replacedFunc);
276276
}
277277
} else if (constant.isDistributedThunk()) {
278-
auto decodeFuncDecl =
278+
// It's okay for `decodeFuncDecl` to be null because system could be
279+
// generic.
280+
if (auto decodeFuncDecl =
279281
getAssociatedDistributedInvocationDecoderDecodeNextArgumentFunction(
280-
decl);
281-
assert(decodeFuncDecl && "decodeNextArgument function not found!");
282-
283-
auto decodeRef = SILDeclRef(decodeFuncDecl);
284-
auto *adHocFunc = getOrCreateDeclaration(decodeFuncDecl, decodeRef);
285-
F->setReferencedAdHocRequirementWitnessFunction(adHocFunc);
282+
decl)) {
283+
auto decodeRef = SILDeclRef(decodeFuncDecl);
284+
auto *adHocFunc = getOrCreateDeclaration(decodeFuncDecl, decodeRef);
285+
F->setReferencedAdHocRequirementWitnessFunction(adHocFunc);
286+
}
286287
}
287288
}
288289

0 commit comments

Comments
 (0)