Skip to content

[Features] Promote IsolatedAny and its alias to a language feature. #74543

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
Jun 19, 2024
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
2 changes: 0 additions & 2 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -5664,8 +5664,6 @@ ERROR(isolated_parameter_combined_nonisolated,none,
ERROR(isolated_parameter_isolated_attr_type,none,
"function with 'isolated' parameter cannot also be '@isolated(%0)'",
(StringRef))
ERROR(isolated_any_experimental,none,
"attribute requires '-enable-experimental-feature IsolatedAny'", ())
ERROR(isolated_attr_global_actor_type,none,
"function type cannot have both a global actor and '@isolated(%0)'",
(StringRef))
Expand Down
8 changes: 2 additions & 6 deletions include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ LANGUAGE_FEATURE(BodyMacros, 415, "Function body macros")
LANGUAGE_FEATURE(TransferringArgsAndResults, 430, "Transferring args and results")
SUPPRESSIBLE_LANGUAGE_FEATURE(SendingArgsAndResults, 430, "Sending arg and results")
LANGUAGE_FEATURE(BorrowingSwitch, 432, "Noncopyable type pattern matching")
CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE(IsolatedAny, 431, "@isolated(any) function types")
LANGUAGE_FEATURE(IsolatedAny2, 431, "@isolated(any) function types")

// Swift 6
UPCOMING_FEATURE(ConciseMagicFile, 274, 6)
Expand Down Expand Up @@ -373,15 +375,9 @@ EXPERIMENTAL_FEATURE(GroupActorErrors, true)
// Enable explicit isolation of closures.
EXPERIMENTAL_FEATURE(ClosureIsolation, true)

// Enable isolated(any) attribute on function types.
CONDITIONALLY_SUPPRESSIBLE_EXPERIMENTAL_FEATURE(IsolatedAny, true)

// Whether lookup of members respects the enclosing file's imports.
EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE(MemberImportVisibility, true)

// Alias for IsolatedAny
EXPERIMENTAL_FEATURE(IsolatedAny2, true)

// Enable @implementation on extensions of ObjC classes.
EXPERIMENTAL_FEATURE(ObjCImplementation, true)

Expand Down
5 changes: 0 additions & 5 deletions lib/Sema/TypeCheckType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3926,11 +3926,6 @@ NeverNullType TypeResolver::resolveASTFunctionType(
if (isolatedAttr && !isolatedAttr->isInvalid()) {
switch (isolatedAttr->getIsolationKind()) {
case IsolatedTypeAttr::IsolationKind::Dynamic:
if (!getASTContext().LangOpts.hasFeature(Feature::IsolatedAny)) {
diagnose(isolatedAttr->getAtLoc(), diag::isolated_any_experimental);
// Proceed as normal.
}

if (representation != FunctionType::Representation::Swift) {
assert(conventionAttr);
diagnoseInvalid(repr, isolatedAttr->getAtLoc(),
Expand Down
5 changes: 0 additions & 5 deletions stdlib/public/Concurrency/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ else()
list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS "-fswift-async-fp=never")
endif()

list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
"-enable-experimental-feature"
"IsolatedAny2"
)

list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS
"-D__STDC_WANT_LIB_EXT1__=1")

Expand Down
2 changes: 1 addition & 1 deletion test/Concurrency/isolated_any.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -typecheck -verify -disable-availability-checking -strict-concurrency=complete -enable-experimental-feature IsolatedAny -enable-upcoming-feature InferSendableFromCaptures %s
// RUN: %target-swift-frontend -typecheck -verify -disable-availability-checking -strict-concurrency=complete -enable-upcoming-feature InferSendableFromCaptures %s

// REQUIRES: asserts

Expand Down
2 changes: 1 addition & 1 deletion test/Distributed/distributed_actor_isolated_any.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/Inputs/FakeDistributedActorSystems.swift

// RUN: %target-swift-frontend -emit-silgen -enable-experimental-feature IsolatedAny %s -module-name test -swift-version 5 -disable-availability-checking -I %t | %FileCheck %s
// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 5 -disable-availability-checking -I %t | %FileCheck %s

// REQUIRES: concurrency
// REQUIRES: asserts
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/isolated_any.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -emit-ir %s -enable-experimental-feature IsolatedAny | %IRGenFileCheck %s
// RUN: %target-swift-frontend -emit-ir %s | %IRGenFileCheck %s

// REQUIRES: concurrency

Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/isolated_any_metadata.sil
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: %swift -emit-ir %s -enable-experimental-feature IsolatedAny -target x86_64-apple-macosx10.10 -disable-legacy-type-info -parse-stdlib | %FileCheck -DINT=i64 %s -check-prefixes=CHECK,CHECK-ACCESSOR
// RUN: %swift -emit-ir %s -enable-experimental-feature IsolatedAny -target x86_64-unknown-linux-gnu -disable-legacy-type-info -parse-stdlib | %FileCheck -DINT=i64 %s -check-prefixes=CHECK,CHECK-DEMANGLE
// RUN: %swift -emit-ir %s -target x86_64-apple-macosx10.10 -disable-legacy-type-info -parse-stdlib | %FileCheck -DINT=i64 %s -check-prefixes=CHECK,CHECK-ACCESSOR
// RUN: %swift -emit-ir %s -target x86_64-unknown-linux-gnu -disable-legacy-type-info -parse-stdlib | %FileCheck -DINT=i64 %s -check-prefixes=CHECK,CHECK-DEMANGLE

// REQUIRES: concurrency

Expand Down
4 changes: 2 additions & 2 deletions test/ModuleInterface/isolated_any_suppression.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %empty-directory(%t)

// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -module-name isolated_any -emit-module -o %t/isolated_any.swiftmodule -emit-module-interface-path - -enable-experimental-feature IsolatedAny %s | %FileCheck %s
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -module-name isolated_any -emit-module -o %t/isolated_any.swiftmodule -emit-module-interface-path - -enable-experimental-feature IsolatedAny2 %s | %FileCheck %s
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -module-name isolated_any -emit-module -o %t/isolated_any.swiftmodule -emit-module-interface-path - %s | %FileCheck %s
// RUN: %target-swift-frontend -swift-version 5 -enable-library-evolution -module-name isolated_any -emit-module -o %t/isolated_any.swiftmodule -emit-module-interface-path - %s | %FileCheck %s

// CHECK: #if compiler(>=5.3) && $IsolatedAny
// CHECK-NEXT: {{^}}public func test1(fn: @isolated(any) @Sendable () -> ())
Expand Down
2 changes: 1 addition & 1 deletion test/Parse/isolated_any.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature IsolatedAny -disable-availability-checking
// RUN: %target-typecheck-verify-swift -disable-availability-checking

// REQUIRES: asserts

Expand Down
2 changes: 1 addition & 1 deletion test/Parse/isolated_any_forbidden.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// RUN: %target-typecheck-verify-swift

typealias FnType = @isolated(any) () -> () // expected-error {{attribute requires '-enable-experimental-feature IsolatedAny'}}
typealias FnType = @isolated(any) () -> ()
2 changes: 1 addition & 1 deletion test/SILGen/isolated_any.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -emit-silgen -enable-experimental-feature IsolatedAny %s -module-name test -swift-version 6 -disable-availability-checking | %FileCheck %s
// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 6 -disable-availability-checking | %FileCheck %s
// REQUIRES: concurrency
// REQUIRES: asserts

Expand Down
2 changes: 1 addition & 1 deletion test/SILGen/isolated_any_conformance.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -emit-silgen -enable-experimental-feature IsolatedAny %s -module-name test -swift-version 6 -disable-availability-checking | %FileCheck %s
// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 6 -disable-availability-checking | %FileCheck %s
// REQUIRES: concurrency
// REQUIRES: asserts

Expand Down
2 changes: 1 addition & 1 deletion test/SILGen/isolated_any_invalid.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -emit-silgen -enable-experimental-feature IsolatedAny %s -module-name test -swift-version 6 -disable-availability-checking -verify
// RUN: %target-swift-frontend -emit-silgen %s -module-name test -swift-version 6 -disable-availability-checking -verify
// REQUIRES: concurrency

func takeSyncIsolatedAny(fn: @escaping @isolated(any) () -> ()) {}
Expand Down
2 changes: 1 addition & 1 deletion test/Sema/availability_isolated_any.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50 -enable-experimental-feature IsolatedAny
// RUN: %target-typecheck-verify-swift -target %target-cpu-apple-macosx10.50

// REQUIRES: OS=macosx

Expand Down
2 changes: 1 addition & 1 deletion test/decl/protocol/conforms/isolated_any.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -typecheck -enable-experimental-feature IsolatedAny -verify %s
// RUN: %target-swift-frontend -typecheck -verify %s

struct A<T> {
// expected-note @+1 {{candidate has non-matching type}}
Expand Down