Skip to content

Commit 4ee1ee1

Browse files
committed
[Concurrency] Gate an isolation inference change behind an upcoming feature
flag. This is just a proactive source compatibility measure, because isolation inference changes like this can break source compatibility in language modes < 6. (cherry picked from commit 0234bd8)
1 parent 5b61828 commit 4ee1ee1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4878,6 +4878,8 @@ getIsolationFromWitnessedRequirements(ValueDecl *value) {
48784878
/// are directly specified on the type.
48794879
static std::optional<ActorIsolation>
48804880
getIsolationFromConformances(NominalTypeDecl *nominal) {
4881+
auto &ctx = nominal->getASTContext();
4882+
48814883
if (isa<ProtocolDecl>(nominal))
48824884
return std::nullopt;
48834885

@@ -4891,8 +4893,13 @@ getIsolationFromConformances(NominalTypeDecl *nominal) {
48914893
// If the superclass has opted out of global actor inference, such as
48924894
// by conforming to the protocol in an extension, then the subclass should
48934895
// not infer isolation from the protocol.
4894-
if (conformance->getKind() == ProtocolConformanceKind::Inherited)
4896+
//
4897+
// Gate this change behind an upcoming feature flag; isolation inference
4898+
// changes can break source in language modes < 6.
4899+
if (conformance->getKind() == ProtocolConformanceKind::Inherited &&
4900+
ctx.LangOpts.hasFeature(Feature::GlobalActorIsolatedTypesUsability)) {
48954901
continue;
4902+
}
48964903

48974904
auto *proto = conformance->getProtocol();
48984905
switch (auto protoIsolation = getActorIsolation(proto)) {

0 commit comments

Comments
 (0)