Skip to content

Commit dde546a

Browse files
committed
[NCGenerics] fix Builtin.createAsyncTask
The SILGen emission for `Builtin.createAsyncTask` performs an existential erasure and assumed that `any Any.Type` has no protocols in its ExistentialLayout, but it's now possible to have some there with NoncopyableGenerics.
1 parent 9bb45e8 commit dde546a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/SILGen/SILGenBuiltin.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1547,11 +1547,16 @@ ManagedValue emitBuiltinCreateAsyncTask(SILGenFunction &SGF, SILLocation loc,
15471547
->getCanonicalType();
15481548
CanType anyTypeType =
15491549
ExistentialMetatypeType::get(ctx.TheAnyType)->getCanonicalType();
1550+
1551+
auto module = SGF.getModule().getSwiftModule();
1552+
auto conformances = module->collectExistentialConformances(futureResultType,
1553+
anyTypeType);
1554+
15501555
auto &anyTypeTL = SGF.getTypeLowering(anyTypeType);
15511556
auto &futureResultTL = SGF.getTypeLowering(futureResultType);
15521557
auto futureResultMetadata =
15531558
SGF.emitExistentialErasure(
1554-
loc, futureResultType, futureResultTL, anyTypeTL, {}, C,
1559+
loc, futureResultType, futureResultTL, anyTypeTL, conformances, C,
15551560
[&](SGFContext C) -> ManagedValue {
15561561
return ManagedValue::forObjectRValueWithoutOwnership(
15571562
SGF.B.createMetatype(loc,

0 commit comments

Comments
 (0)