Skip to content

Commit ba9b302

Browse files
committed
AST: Make $UnavailableFromAsync and $NoAsyncAvailability baseline features.
They have been available since at least Swift 5.8.
1 parent d5e3e94 commit ba9b302

File tree

4 files changed

+6
-37
lines changed

4 files changed

+6
-37
lines changed

include/swift/Basic/Features.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ BASELINE_LANGUAGE_FEATURE(BuiltinAssumeAlignment, 0, "Builtin.assumeAlignment")
147147
BASELINE_LANGUAGE_FEATURE(BuiltinCreateTaskGroupWithFlags, 0, "Builtin.createTaskGroupWithFlags")
148148
BASELINE_LANGUAGE_FEATURE(UnsafeInheritExecutor, 0, "@_unsafeInheritExecutor")
149149
SUPPRESSIBLE_LANGUAGE_FEATURE(PrimaryAssociatedTypes2, 346, "Primary associated types")
150-
SUPPRESSIBLE_LANGUAGE_FEATURE(UnavailableFromAsync, 0, "@_unavailableFromAsync")
151-
SUPPRESSIBLE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)")
150+
BASELINE_LANGUAGE_FEATURE(UnavailableFromAsync, 0, "@_unavailableFromAsync")
151+
BASELINE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)")
152152
SUPPRESSIBLE_LANGUAGE_FEATURE(AssociatedTypeAvailability, 0, "Availability on associated types")
153153
SUPPRESSIBLE_LANGUAGE_FEATURE(AsyncSequenceFailure, 0, "Failure associated type on AsyncSequence and AsyncIteratorProtocol")
154154
BASELINE_LANGUAGE_FEATURE(BuiltinIntLiteralAccessors, 368, "Builtin.IntLiteral accessors")

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,15 +3035,6 @@ static void suppressingFeaturePrimaryAssociatedTypes2(PrintOptions &options,
30353035
options.PrintPrimaryAssociatedTypes = originalPrintPrimaryAssociatedTypes;
30363036
}
30373037

3038-
static void
3039-
suppressingFeatureUnavailableFromAsync(PrintOptions &options,
3040-
llvm::function_ref<void()> action) {
3041-
unsigned originalExcludeAttrCount = options.ExcludeAttrList.size();
3042-
options.ExcludeAttrList.push_back(DeclAttrKind::UnavailableFromAsync);
3043-
action();
3044-
options.ExcludeAttrList.resize(originalExcludeAttrCount);
3045-
}
3046-
30473038
static void
30483039
suppressingFeatureAssociatedTypeAvailability(
30493040
PrintOptions &options, llvm::function_ref<void()> action) {
@@ -3070,14 +3061,6 @@ suppressingFeatureLexicalLifetimes(PrintOptions &options,
30703061
options.ExcludeAttrList.resize(originalExcludeAttrCount);
30713062
}
30723063

3073-
static void
3074-
suppressingFeatureNoAsyncAvailability(PrintOptions &options,
3075-
llvm::function_ref<void()> action) {
3076-
llvm::SaveAndRestore<PrintOptions> originalOptions(options);
3077-
options.SuppressNoAsyncAvailabilityAttr = true;
3078-
action();
3079-
}
3080-
30813064
static void suppressingFeatureRetroactiveAttribute(
30823065
PrintOptions &options,
30833066
llvm::function_ref<void()> action) {

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,6 @@ static bool usesFeaturePrimaryAssociatedTypes2(Decl *decl) {
210210
return false;
211211
}
212212

213-
static bool usesFeatureUnavailableFromAsync(Decl *decl) {
214-
return decl->getAttrs().hasAttribute<UnavailableFromAsyncAttr>();
215-
}
216-
217-
static bool usesFeatureNoAsyncAvailability(Decl *decl) {
218-
return decl->getAttrs().getNoAsync(decl->getASTContext()) != nullptr;
219-
}
220-
221213
static bool usesFeatureAssociatedTypeAvailability(Decl *decl) {
222214
return isa<AssociatedTypeDecl>(decl) &&
223215
decl->getAttrs().hasAttribute<AvailableAttr>();

test/ModuleInterface/features.swift

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// RUN: --implicit-check-not "\$Sendable" \
1010
// RUN: --implicit-check-not "\$InheritActorContext" \
1111
// RUN: --implicit-check-not "\$UnsafeInheritExecutor" \
12+
// RUN: --implicit-check-not "\$NoAsyncAvailability" \
13+
// RUN: --implicit-check-not "\$UnavailableFromAsync" \
1214
// RUN: < %t/FeatureTest.swiftinterface
1315

1416
// REQUIRES: concurrency
@@ -146,20 +148,12 @@ public func unsafeInheritExecutor() async {}
146148
@_specialize(exported: true, availability: SwiftStdlib 5.1, *; where T == Int)
147149
public func unsafeInheritExecutorAndSpecialize<T>(value: T) async {}
148150

149-
// CHECK: #if compiler(>=5.3) && $UnavailableFromAsync
150-
// CHECK-NEXT: @_unavailableFromAsync(message: "Test") public func unavailableFromAsyncFunc()
151-
// CHECK-NEXT: #else
152-
// CHECK-NEXT: public func unavailableFromAsyncFunc()
153-
// CHECK-NEXT: #endif
151+
// CHECK: @_unavailableFromAsync(message: "Test") public func unavailableFromAsyncFunc()
154152
@_unavailableFromAsync(message: "Test")
155153
public func unavailableFromAsyncFunc() { }
156154

157-
// CHECK: #if compiler(>=5.3) && $NoAsyncAvailability
158-
// CHECK-NEXT: @available(*, noasync, message: "Test")
155+
// CHECK: @available(*, noasync, message: "Test")
159156
// CHECK-NEXT: public func noAsyncFunc()
160-
// CHECK-NEXT: #else
161-
// CHECK-NEXT: public func noAsyncFunc()
162-
// CHECK-NEXT: #endif
163157
@available(*, noasync, message: "Test")
164158
public func noAsyncFunc() { }
165159

0 commit comments

Comments
 (0)