mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[concurrency] global actors in reslient modules need thick metatype.
Resolves rdar://72604101
This commit is contained in:
@@ -514,10 +514,15 @@ SILValue SILGenFunction::emitLoadGlobalActorExecutor(Type globalActor) {
|
||||
Type instanceType =
|
||||
actorType->getTypeOfMember(SGM.SwiftModule, sharedInstanceDecl);
|
||||
|
||||
auto metaRepr =
|
||||
nominal->isResilient(SGM.SwiftModule, ResilienceExpansion::Maximal)
|
||||
? MetatypeRepresentation::Thick
|
||||
: MetatypeRepresentation::Thin;
|
||||
|
||||
ManagedValue actorMetaType =
|
||||
ManagedValue::forUnmanaged(B.createMetatype(loc,
|
||||
SILType::getPrimitiveObjectType(
|
||||
CanMetatypeType::get(actorType, MetatypeRepresentation::Thin))));
|
||||
CanMetatypeType::get(actorType, metaRepr))));
|
||||
|
||||
RValue actorInstanceRV = emitRValueForStorageLoad(loc, actorMetaType,
|
||||
actorType, /*isSuper*/ false, sharedInstanceDecl, PreparedArguments(),
|
||||
|
||||
10
test/ModuleInterface/Inputs/MeowActor.swift
Normal file
10
test/ModuleInterface/Inputs/MeowActor.swift
Normal file
@@ -0,0 +1,10 @@
|
||||
@globalActor public final class MeowActor {
|
||||
public static let shared = _Impl()
|
||||
|
||||
public actor class _Impl {
|
||||
@actorIndependent
|
||||
public func enqueue(partialTask: PartialAsyncTask) {
|
||||
// DOES NOTHING! :)
|
||||
}
|
||||
}
|
||||
}
|
||||
17
test/ModuleInterface/global-actor.swift
Normal file
17
test/ModuleInterface/global-actor.swift
Normal file
@@ -0,0 +1,17 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
|
||||
import MeowActor
|
||||
|
||||
@MeowActor func doMeow() {}
|
||||
|
||||
// RUN: %target-swift-frontend -enable-experimental-concurrency -enable-library-evolution -emit-module -o %t/MeowActor.swiftmodule %S/Inputs/MeowActor.swift
|
||||
// RUN: %target-swift-frontend -enable-experimental-concurrency -emit-silgen %s -I %t | %FileCheck --check-prefix CHECK-RESILIENT %s
|
||||
// CHECK-RESILIENT: metatype $@thick MeowActor.Type
|
||||
|
||||
// RUN: %target-swift-frontend -enable-experimental-concurrency -emit-module -o %t/MeowActor.swiftmodule %S/Inputs/MeowActor.swift
|
||||
// RUN: %target-swift-frontend -enable-experimental-concurrency -emit-silgen %s -I %t | %FileCheck --check-prefix CHECK-FRAGILE %s
|
||||
// CHECK-FRAGILE: metatype $@thin MeowActor.Type
|
||||
|
||||
func someFunc() async {
|
||||
await doMeow()
|
||||
}
|
||||
Reference in New Issue
Block a user