Skip to content

[Concurrency] Gate an isolation inference change behind an upcoming feature flag. #75251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/Sema/TypeCheckConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4891,6 +4891,8 @@ getIsolationFromWitnessedRequirements(ValueDecl *value) {
/// are directly specified on the type.
static std::optional<ActorIsolation>
getIsolationFromConformances(NominalTypeDecl *nominal) {
auto &ctx = nominal->getASTContext();

if (isa<ProtocolDecl>(nominal))
return std::nullopt;

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

auto *proto = conformance->getProtocol();
switch (auto protoIsolation = getActorIsolation(proto)) {
Expand Down