Skip to content

Commit ab82f3d

Browse files
committed
[Concurrency] SE-0466: Replace UnspecifiedMeansMainActorIsolated flag with -default-isolation
1 parent b666424 commit ab82f3d

8 files changed

+11
-22
lines changed

include/swift/Basic/Features.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,6 @@ EXPERIMENTAL_FEATURE(ImportNonPublicCxxMembers, true)
465465
// Isolated deinit
466466
SUPPRESSIBLE_LANGUAGE_FEATURE(IsolatedDeinit, 371, "isolated deinit")
467467

468-
// When a parameter has unspecified isolation, infer it as main actor isolated.
469-
EXPERIMENTAL_FEATURE(UnspecifiedMeansMainActorIsolated, false)
470-
471468
/// modify/read single-yield coroutines
472469
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(CoroutineAccessors, true)
473470

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ UNINTERESTING_FEATURE(StaticExclusiveOnly)
199199
UNINTERESTING_FEATURE(ExtractConstantsFromMembers)
200200
UNINTERESTING_FEATURE(GroupActorErrors)
201201
UNINTERESTING_FEATURE(SameElementRequirements)
202-
UNINTERESTING_FEATURE(UnspecifiedMeansMainActorIsolated)
203202

204203
static bool usesFeatureSendingArgsAndResults(Decl *decl) {
205204
auto isFunctionTypeWithSending = [](Type type) {

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5797,7 +5797,7 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
57975797

57985798
// If we are required to use main actor... just use that.
57995799
if (!ignoreUnspecifiedMeansMainActorIsolated &&
5800-
ctx.LangOpts.hasFeature(Feature::UnspecifiedMeansMainActorIsolated))
5800+
ctx.LangOpts.DefaultIsolationBehavior == DefaultIsolation::MainActor)
58015801
if (auto result =
58025802
globalActorHelper(ctx.getMainActorType()->mapTypeOutOfContext()))
58035803
return *result;
@@ -7936,7 +7936,7 @@ ConformanceIsolationRequest::evaluate(Evaluator &evaluator, ProtocolConformance
79367936
// In a context where we are inferring @MainActor, if the conforming type
79377937
// is on the main actor, then the conformance is, too.
79387938
auto nominal = dc->getSelfNominalTypeDecl();
7939-
if (ctx.LangOpts.hasFeature(Feature::UnspecifiedMeansMainActorIsolated) &&
7939+
if (ctx.LangOpts.DefaultIsolationBehavior == DefaultIsolation::MainActor &&
79407940
nominal) {
79417941
auto nominalIsolation = getActorIsolation(nominal);
79427942
if (nominalIsolation.isMainActor()) {

test/Concurrency/Runtime/unspecified_is_main_actor.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -swift-version 6 -g -import-objc-header %S/Inputs/RunOnMainActor.h %import-libdispatch -enable-experimental-feature UnspecifiedMeansMainActorIsolated )
1+
// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -swift-version 6 -g -import-objc-header %S/Inputs/RunOnMainActor.h %import-libdispatch -Xfrontend -default-isolation=MainActor )
22

33
// REQUIRES: executable_test
44
// REQUIRES: concurrency
55
// REQUIRES: concurrency_runtime
66
// REQUIRES: libdispatch
77
// REQUIRES: asserts
8-
// REQUIRES: swift_feature_UnspecifiedMeansMainActorIsolated
98

109
// UNSUPPORTED: freestanding
1110

test/Concurrency/assume_mainactor.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
// RUN: %target-swift-frontend -swift-version 6 -emit-silgen -enable-experimental-feature UnspecifiedMeansMainActorIsolated %s | %FileCheck %s
2-
// RUN: %target-swift-frontend -swift-version 6 -emit-sil -enable-experimental-feature UnspecifiedMeansMainActorIsolated %s -verify
3-
4-
// REQUIRES: swift_feature_UnspecifiedMeansMainActorIsolated
1+
// RUN: %target-swift-frontend -swift-version 6 -emit-silgen -default-isolation MainActor %s | %FileCheck %s
2+
// RUN: %target-swift-frontend -swift-version 6 -emit-sil -default-isolation MainActor %s -verify
53

64
// READ THIS! This test is meant to FileCheck the specific isolation when
7-
// UnspecifiedMeansMainActorIsolated is enabled. Please do not put other types
5+
// `-default-isolation` is set to `MainActor`. Please do not put other types
86
// of tests in here.
97

108
class Klass {

test/Concurrency/assume_mainactor_typechecker_errors.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
// RUN: %target-swift-frontend -swift-version 6 -emit-sil -enable-experimental-feature UnspecifiedMeansMainActorIsolated %s -verify
2-
3-
// REQUIRES: swift_feature_UnspecifiedMeansMainActorIsolated
1+
// RUN: %target-swift-frontend -swift-version 6 -emit-sil -default-isolation MainActor %s -verify
42

53
// READ THIS! This test is meant to check the specific isolation when
6-
// UnspecifiedMeansMainActorIsolated is enabled in combination with validating
4+
// `-default-isolation` is set to `MainActor` in combination with validating
75
// behavior around explicitly non-Sendable types that trigger type checker
86
// specific errors. Please do not put other types of tests in here.
97

test/Concurrency/isolated_conformance_default_actor.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// RUN: %target-swift-frontend -typecheck -verify -target %target-swift-5.1-abi-triple -swift-version 6 -enable-experimental-feature IsolatedConformances -enable-experimental-feature UnspecifiedMeansMainActorIsolated %s
1+
// RUN: %target-swift-frontend -typecheck -verify -target %target-swift-5.1-abi-triple -swift-version 6 -enable-experimental-feature IsolatedConformances -default-isolation MainActor %s
22

33
// REQUIRES: swift_feature_IsolatedConformances
4-
// REQUIRES: swift_feature_UnspecifiedMeansMainActorIsolated
54
// REQUIRES: concurrency
65

76
nonisolated

test/Concurrency/swiftsettings_defaultIsolation.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
// RUN: %target-swift-frontend -enable-experimental-feature SwiftSettings -c -verify -swift-version 6 -verify-additional-prefix nonisolated- -disable-availability-checking %s
22
// RUN: %target-swift-frontend -enable-experimental-feature SwiftSettings -c -verify -swift-version 6 -verify-additional-prefix main-actor- -disable-availability-checking -DSWIFT_SETTINGS_MAIN_ACTOR %s
3-
// RUN: %target-swift-frontend -enable-experimental-feature UnspecifiedMeansMainActorIsolated -enable-experimental-feature SwiftSettings -c -verify -swift-version 6 -disable-availability-checking -verify-additional-prefix main-actor- %s
4-
// RUN: %target-swift-frontend -enable-experimental-feature UnspecifiedMeansMainActorIsolated -enable-experimental-feature SwiftSettings -c -verify -swift-version 6 -disable-availability-checking -verify-additional-prefix nonisolated- -DSWIFT_SETTINGS_NONISOLATED %s
3+
// RUN: %target-swift-frontend -default-isolation MainActor -enable-experimental-feature SwiftSettings -c -verify -swift-version 6 -disable-availability-checking -verify-additional-prefix main-actor- %s
4+
// RUN: %target-swift-frontend -default-isolation MainActor -enable-experimental-feature SwiftSettings -c -verify -swift-version 6 -disable-availability-checking -verify-additional-prefix nonisolated- -DSWIFT_SETTINGS_NONISOLATED %s
55

66
// REQUIRES: asserts
77
// REQUIRES: concurrency
8-
// REQUIRES: swift_feature_UnspecifiedMeansMainActorIsolated
98
// REQUIRES: swift_feature_SwiftSettings
109

1110
#if SWIFT_SETTINGS_MAIN_ACTOR

0 commit comments

Comments
 (0)