Skip to content

Commit dd28a3e

Browse files
committed
AST: Re-baseline IsolatedAny feature.
1 parent 491a43a commit dd28a3e

File tree

6 files changed

+3
-37
lines changed

6 files changed

+3
-37
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,6 @@ struct PrintOptions {
437437
/// Whether to suppress printing of custom attributes that are expanded macros.
438438
bool SuppressExpandedMacros = true;
439439

440-
/// Suppress the @isolated(any) attribute.
441-
bool SuppressIsolatedAny = false;
442-
443440
/// Suppress 'isolated' and '#isolation' on isolated parameters with optional type.
444441
bool SuppressOptionalIsolatedParams = false;
445442

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ BASELINE_LANGUAGE_FEATURE(BitwiseCopyable2, 426, "BitwiseCopyable feature")
250250
BASELINE_LANGUAGE_FEATURE(BodyMacros, 415, "Function body macros")
251251
SUPPRESSIBLE_LANGUAGE_FEATURE(SendingArgsAndResults, 430, "Sending arg and results")
252252
BASELINE_LANGUAGE_FEATURE(BorrowingSwitch, 432, "Noncopyable type pattern matching")
253-
CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE(IsolatedAny, 431, "@isolated(any) function types")
253+
BASELINE_LANGUAGE_FEATURE(IsolatedAny, 431, "@isolated(any) function types")
254254
LANGUAGE_FEATURE(IsolatedAny2, 431, "@isolated(any) function types")
255255
LANGUAGE_FEATURE(ObjCImplementation, 436, "@objc @implementation extensions")
256256
LANGUAGE_FEATURE(NonescapableTypes, 446, "Nonescapable types")

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3234,12 +3234,6 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
32343234
}
32353235
}
32363236

3237-
static void suppressingFeatureIsolatedAny(PrintOptions &options,
3238-
llvm::function_ref<void()> action) {
3239-
llvm::SaveAndRestore<bool> scope(options.SuppressIsolatedAny, true);
3240-
action();
3241-
}
3242-
32433237
static void
32443238
suppressingFeatureSendingArgsAndResults(PrintOptions &options,
32453239
llvm::function_ref<void()> action) {
@@ -6544,8 +6538,7 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
65446538
break;
65456539

65466540
case FunctionTypeIsolation::Kind::Erased:
6547-
if (!Options.SuppressIsolatedAny)
6548-
Printer << "@isolated(any) ";
6541+
Printer << "@isolated(any) ";
65496542
break;
65506543

65516544
case FunctionTypeIsolation::Kind::NonIsolatedCaller:

lib/AST/Attr.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,6 @@ const char *IsolatedTypeAttr::getIsolationKindName(IsolationKind kind) {
291291

292292
void IsolatedTypeAttr::printImpl(ASTPrinter &printer,
293293
const PrintOptions &options) const {
294-
// Suppress the attribute if requested.
295-
switch (getIsolationKind()) {
296-
case IsolationKind::Dynamic:
297-
if (options.SuppressIsolatedAny) return;
298-
break;
299-
}
300-
301294
printer.callPrintStructurePre(PrintStructureKind::BuiltinAttribute);
302295
printer.printAttrName("@isolated");
303296
printer << "(" << getIsolationKindName() << ")";

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,6 @@ UNINTERESTING_FEATURE(ClosureIsolation)
361361
UNINTERESTING_FEATURE(Extern)
362362
UNINTERESTING_FEATURE(ConsumeSelfInDeinit)
363363

364-
static bool usesFeatureIsolatedAny(Decl *decl) {
365-
return usesTypeMatching(decl, [](Type type) {
366-
if (auto fnType = type->getAs<AnyFunctionType>()) {
367-
return fnType->getIsolation().isErased();
368-
}
369-
return false;
370-
});
371-
}
372-
373364
static bool usesFeatureAddressableParameters(Decl *d) {
374365
if (d->getAttrs().hasAttribute<AddressableSelfAttr>()) {
375366
return true;

test/ModuleInterface/isolated_any_suppression.swift renamed to test/ModuleInterface/isolated_any.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,13 @@
33
// 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
44
// 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
55

6-
// CHECK: #if compiler(>=5.3) && $IsolatedAny
7-
// CHECK-NEXT: {{^}}public func test1(fn: @isolated(any) @Sendable () -> ())
8-
// CHECK-NEXT: #endif
6+
// CHECK: {{^}}public func test1(fn: @isolated(any) @Sendable () -> ())
97
public func test1(fn: @isolated(any) @Sendable () -> ()) {}
108

11-
// CHECK-NEXT: #if compiler(>=5.3) && $IsolatedAny
129
// CHECK-NEXT: {{^}}public func test2(fn: @isolated(any) @Sendable () -> ())
13-
// CHECK-NEXT: #endif
1410
@_allowFeatureSuppression(XXX)
1511
public func test2(fn: @isolated(any) @Sendable () -> ()) {}
1612

17-
// CHECK-NEXT: #if compiler(>=5.3) && $IsolatedAny
1813
// CHECK-NEXT: {{^}}public func test3(fn: @isolated(any) @Sendable () -> ())
19-
// CHECK-NEXT: #else
20-
// CHECK-NEXT: {{^}}public func test3(fn: @Sendable () -> ())
21-
// CHECK-NEXT: #endif
2214
@_allowFeatureSuppression(IsolatedAny)
2315
public func test3(fn: @isolated(any) @Sendable () -> ()) {}

0 commit comments

Comments
 (0)