Skip to content

Commit e850f17

Browse files
committed
[Concurrency] SE-0466: Replace UnspecifiedMeansMainActorIsolated flag with -default-isolation
1 parent 2221c14 commit e850f17

8 files changed

+10
-21
lines changed

include/swift/Basic/Features.def

-3
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

-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ UNINTERESTING_FEATURE(StaticExclusiveOnly)
205205
UNINTERESTING_FEATURE(ExtractConstantsFromMembers)
206206
UNINTERESTING_FEATURE(GroupActorErrors)
207207
UNINTERESTING_FEATURE(SameElementRequirements)
208-
UNINTERESTING_FEATURE(UnspecifiedMeansMainActorIsolated)
209208

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

lib/Sema/TypeCheckConcurrency.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -5798,7 +5798,7 @@ computeDefaultInferredActorIsolation(ValueDecl *value) {
57985798

57995799
// If we are required to use main actor... just use that.
58005800
if (!ignoreUnspecifiedMeansMainActorIsolated &&
5801-
ctx.LangOpts.hasFeature(Feature::UnspecifiedMeansMainActorIsolated))
5801+
ctx.LangOpts.DefaultIsolationBehavior == DefaultIsolation::MainActor)
58025802
if (auto result =
58035803
globalActorHelper(ctx.getMainActorType()->mapTypeOutOfContext()))
58045804
return *result;

test/Concurrency/Runtime/unspecified_is_main_actor.swift

+1-2
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

+3-5
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

+2-4
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

+1-2
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

+2-3
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)