Skip to content

Commit cc55495

Browse files
authored
Merge pull request #75251 from hborla/gate-isolation-inference-change
[Concurrency] Gate an isolation inference change behind an upcoming feature flag.
2 parents b55f881 + 0234bd8 commit cc55495

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
@@ -4891,6 +4891,8 @@ getIsolationFromWitnessedRequirements(ValueDecl *value) {
48914891
/// are directly specified on the type.
48924892
static std::optional<ActorIsolation>
48934893
getIsolationFromConformances(NominalTypeDecl *nominal) {
4894+
auto &ctx = nominal->getASTContext();
4895+
48944896
if (isa<ProtocolDecl>(nominal))
48954897
return std::nullopt;
48964898

@@ -4904,8 +4906,13 @@ getIsolationFromConformances(NominalTypeDecl *nominal) {
49044906
// If the superclass has opted out of global actor inference, such as
49054907
// by conforming to the protocol in an extension, then the subclass should
49064908
// not infer isolation from the protocol.
4907-
if (conformance->getKind() == ProtocolConformanceKind::Inherited)
4909+
//
4910+
// Gate this change behind an upcoming feature flag; isolation inference
4911+
// changes can break source in language modes < 6.
4912+
if (conformance->getKind() == ProtocolConformanceKind::Inherited &&
4913+
ctx.LangOpts.hasFeature(Feature::GlobalActorIsolatedTypesUsability)) {
49084914
continue;
4915+
}
49094916

49104917
auto *proto = conformance->getProtocol();
49114918
switch (auto protoIsolation = getActorIsolation(proto)) {

0 commit comments

Comments
 (0)