Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ SUPPRESSIBLE_EXPERIMENTAL_FEATURE(CustomAvailability, true)
/// Be strict about the Sendable conformance of metatypes.
EXPERIMENTAL_FEATURE(StrictSendableMetatypes, true)


/// Allow public enumerations to be extensible by default
/// regardless of whether the module they are declared in
/// is resilient or not.
Expand All @@ -505,6 +504,9 @@ EXPERIMENTAL_FEATURE(ExtensibleEnums, true)
/// Allow isolated conformances.
EXPERIMENTAL_FEATURE(IsolatedConformances, true)

/// Infer conformance isolation on global-actor-conforming types.
EXPERIMENTAL_FEATURE(InferIsolatedConformances, true)

/// Allow SwiftSettings
EXPERIMENTAL_FEATURE(SwiftSettings, false)

Expand Down
1 change: 1 addition & 0 deletions lib/AST/FeatureSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ UNINTERESTING_FEATURE(ReinitializeConsumeInMultiBlockDefer)
UNINTERESTING_FEATURE(SE427NoInferenceOnExtension)
UNINTERESTING_FEATURE(TrailingComma)
UNINTERESTING_FEATURE(RawIdentifiers)
UNINTERESTING_FEATURE(InferIsolatedConformances)

static ABIAttr *getABIAttr(Decl *decl) {
if (auto pbd = dyn_cast<PatternBindingDecl>(decl))
Expand Down
3 changes: 3 additions & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,9 @@ static bool ParseEnabledFeatureArgs(LangOptions &Opts, ArgList &Args,
if (Args.hasArg(OPT_strict_memory_safety))
Opts.enableFeature(Feature::StrictMemorySafety);

if (Opts.hasFeature(Feature::UnspecifiedMeansMainActorIsolated))
Opts.enableFeature(Feature::InferIsolatedConformances);

return HadError;
}

Expand Down
12 changes: 6 additions & 6 deletions lib/Sema/TypeCheckConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4113,7 +4113,8 @@ namespace {
}

if (auto *macro = dyn_cast<MacroExpansionExpr>(expr)) {
expr = macro->getRewritten();
if (auto rewritten = macro->getRewritten())
expr = rewritten;
}

if (auto *isolation = dyn_cast<CurrentContextIsolationExpr>(expr)) {
Expand Down Expand Up @@ -7923,15 +7924,14 @@ ConformanceIsolationRequest::evaluate(Evaluator &evaluator, ProtocolConformance
if (getActorIsolation(rootNormal->getProtocol()).isActorIsolated())
return ActorIsolation::forNonisolated(false);

// In a context where we are inferring @MainActor, if the conforming type
// is on the main actor, then the conformance is, too.
// If we are inferring isolated conformances and the conforming type is
// isolated to a global actor,
auto nominal = dc->getSelfNominalTypeDecl();
if (ctx.LangOpts.hasFeature(Feature::UnspecifiedMeansMainActorIsolated) &&
if (ctx.LangOpts.hasFeature(Feature::InferIsolatedConformances) &&
nominal) {
auto nominalIsolation = getActorIsolation(nominal);
if (nominalIsolation.isMainActor()) {
if (nominalIsolation.isGlobalActor())
return nominalIsolation;
}
}

return ActorIsolation::forNonisolated(false);
Expand Down