mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[concurrency] initial declaration of MainActor
Implementation is left as a TODO for now. Resolves rdar://72161578 Partially resolves rdar://72105129
This commit is contained in:
@@ -414,6 +414,11 @@ public:
|
||||
if (!printOptions.shouldPrint(nominal))
|
||||
return;
|
||||
|
||||
/// is this nominal specifically an 'actor class'?
|
||||
bool actorClass = false;
|
||||
if (auto klass = dyn_cast<ClassDecl>(nominal))
|
||||
actorClass = klass->isActor();
|
||||
|
||||
SmallPtrSet<ProtocolDecl *, 16> handledProtocols;
|
||||
|
||||
// First record all protocols that have already been handled.
|
||||
@@ -438,6 +443,15 @@ public:
|
||||
if (!handledProtocols.insert(inherited).second)
|
||||
return TypeWalker::Action::SkipChildren;
|
||||
|
||||
// If 'nominal' is an 'actor class', we do not synthesize its
|
||||
// conformance to the Actor protocol through a dummy extension.
|
||||
// There is a special restriction on the Actor protocol in that
|
||||
// it is only valid to conform to Actor on an 'actor class' decl,
|
||||
// not extensions of that 'actor class'.
|
||||
if (actorClass &&
|
||||
inherited->isSpecificProtocol(KnownProtocolKind::Actor))
|
||||
return TypeWalker::Action::Continue;
|
||||
|
||||
if (isPublicOrUsableFromInline(inherited) &&
|
||||
conformanceDeclaredInModule(M, nominal, inherited)) {
|
||||
protocolsToPrint.push_back({inherited, protoAndAvailability.second});
|
||||
|
||||
Reference in New Issue
Block a user