Skip to content

Commit 6f972fc

Browse files
committed
AST: Promote AssociatedTypeAvailability feature to the baseline.
1 parent 588a7db commit 6f972fc

File tree

4 files changed

+2
-20
lines changed

4 files changed

+2
-20
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ BASELINE_LANGUAGE_FEATURE(UnsafeInheritExecutor, 0, "@_unsafeInheritExecutor")
169169
SUPPRESSIBLE_LANGUAGE_FEATURE(PrimaryAssociatedTypes2, 346, "Primary associated types")
170170
BASELINE_LANGUAGE_FEATURE(UnavailableFromAsync, 0, "@_unavailableFromAsync")
171171
BASELINE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)")
172-
SUPPRESSIBLE_LANGUAGE_FEATURE(AssociatedTypeAvailability, 0, "Availability on associated types")
172+
BASELINE_LANGUAGE_FEATURE(AssociatedTypeAvailability, 0, "Availability on associated types")
173173
SUPPRESSIBLE_LANGUAGE_FEATURE(AsyncSequenceFailure, 0, "Failure associated type on AsyncSequence and AsyncIteratorProtocol")
174174
BASELINE_LANGUAGE_FEATURE(BuiltinIntLiteralAccessors, 368, "Builtin.IntLiteral accessors")
175175
LANGUAGE_FEATURE(Macros, 0, "Macros")

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3067,15 +3067,6 @@ static void suppressingFeaturePrimaryAssociatedTypes2(PrintOptions &options,
30673067
options.PrintPrimaryAssociatedTypes = originalPrintPrimaryAssociatedTypes;
30683068
}
30693069

3070-
static void
3071-
suppressingFeatureAssociatedTypeAvailability(
3072-
PrintOptions &options, llvm::function_ref<void()> action) {
3073-
unsigned originalExcludeAttrCount = options.ExcludeAttrList.size();
3074-
options.ExcludeAttrList.push_back(DeclAttrKind::Available);
3075-
action();
3076-
options.ExcludeAttrList.resize(originalExcludeAttrCount);
3077-
}
3078-
30793070
static void
30803071
suppressingFeatureAsyncSequenceFailure(
30813072
PrintOptions &options, llvm::function_ref<void()> action) {

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,6 @@ static bool usesFeaturePrimaryAssociatedTypes2(Decl *decl) {
150150
return false;
151151
}
152152

153-
static bool usesFeatureAssociatedTypeAvailability(Decl *decl) {
154-
return isa<AssociatedTypeDecl>(decl) &&
155-
decl->getAttrs().hasAttribute<AvailableAttr>();
156-
}
157-
158153
static bool isImplicitRethrowsProtocol(const ProtocolDecl *proto) {
159154
return proto->isSpecificProtocol(KnownProtocolKind::AsyncSequence) ||
160155
proto->isSpecificProtocol(KnownProtocolKind::AsyncIteratorProtocol);

test/ModuleInterface/associated_type_availability.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66

77
// CHECK: public protocol P
88
public protocol P {
9-
// CHECK: #if compiler(>=5.3) && $AssociatedTypeAvailability
10-
// CHECK-NEXT: @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
9+
// CHECK: @available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
1110
// CHECK-NEXT: associatedtype AT = Self
12-
// CHECK-NEXT: #else
13-
// CHECK-NEXT: associatedtype AT = Self
14-
// CHECK-NEXT: #endif
1511
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
1612
associatedtype AT = Self
1713
}

0 commit comments

Comments
 (0)