[SILGen] Fix formal type of global actor metatype.

Fixes a crash reported in rdar://103255322 .
This commit is contained in:
Doug Gregor
2022-12-16 12:33:09 -08:00
parent 4ef35c5f14
commit 0e8d4c470e
4 changed files with 26 additions and 8 deletions

View File

@@ -897,13 +897,13 @@ SILValue SILGenFunction::emitLoadGlobalActorExecutor(Type globalActor) {
? MetatypeRepresentation::Thick
: MetatypeRepresentation::Thin;
ManagedValue actorMetaType =
CanType actorMetaType = CanMetatypeType::get(actorType, metaRepr);
ManagedValue actorMetaTypeValue =
ManagedValue::forUnmanaged(B.createMetatype(loc,
SILType::getPrimitiveObjectType(
CanMetatypeType::get(actorType, metaRepr))));
SILType::getPrimitiveObjectType(actorMetaType)));
RValue actorInstanceRV = emitRValueForStorageLoad(loc, actorMetaType,
actorType, /*isSuper*/ false, sharedInstanceDecl, PreparedArguments(),
RValue actorInstanceRV = emitRValueForStorageLoad(loc, actorMetaTypeValue,
actorMetaType, /*isSuper*/ false, sharedInstanceDecl, PreparedArguments(),
subs, AccessSemantics::Ordinary, instanceType, SGFContext());
ManagedValue actorInstance = std::move(actorInstanceRV).getScalarValue();
return emitLoadActorExecutor(loc, actorInstance);