Skip to content

Commit 723d7b7

Browse files
committed
[Concurrency] Allow isolation on subclasses of non-Sendable, non-isolated
superclasses.
1 parent e7db0ec commit 723d7b7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4776,9 +4776,14 @@ static bool checkClassGlobalActorIsolation(
47764776
switch (superIsolation) {
47774777
case ActorIsolation::Unspecified:
47784778
case ActorIsolation::Nonisolated:
4779-
case ActorIsolation::NonisolatedUnsafe:
4779+
case ActorIsolation::NonisolatedUnsafe: {
4780+
auto &ctx = classDecl->getASTContext();
4781+
if (ctx.LangOpts.hasFeature(Feature::GlobalActorIsolatedTypesUsability))
4782+
return false;
4783+
47804784
downgradeToWarning = true;
47814785
break;
4786+
}
47824787

47834788
case ActorIsolation::Erased:
47844789
llvm_unreachable("class cannot have erased isolation");
@@ -6004,6 +6009,13 @@ ProtocolConformance *swift::deriveImplicitSendableConformance(
60046009
inheritedConformance.getConcrete());
60056010
}
60066011
}
6012+
6013+
// Classes that add global actor isolation to non-Sendable
6014+
// superclasses cannot be 'Sendable'.
6015+
if (ctx.LangOpts.hasFeature(Feature::GlobalActorIsolatedTypesUsability) &&
6016+
nominal->getGlobalActorAttr()) {
6017+
return nullptr;
6018+
}
60076019
}
60086020
}
60096021

0 commit comments

Comments
 (0)