Skip to content

Commit 6b9b7bc

Browse files
committed
AST: Promote PrimaryAssociatedTypes2 feature to the baseline.
1 parent b5acc6b commit 6b9b7bc

File tree

5 files changed

+3
-36
lines changed

5 files changed

+3
-36
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,6 @@ struct PrintOptions {
608608
QualifyNestedDeclarations ShouldQualifyNestedDeclarations =
609609
QualifyNestedDeclarations::Never;
610610

611-
/// If true, we print a protocol's primary associated types using the
612-
/// primary associated type syntax: `protocol Foo<Type1, ...>`.
613-
///
614-
/// If false, we print them as ordinary associated types.
615-
bool PrintPrimaryAssociatedTypes = true;
616-
617611
/// Whether or not to print `@attached(extension)` attributes on
618612
/// macro declarations. This is used for feature suppression in
619613
/// Swift interface printing.

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(SpecializeAttributeWithAvailability, 0, "@_special
166166
BASELINE_LANGUAGE_FEATURE(BuiltinAssumeAlignment, 0, "Builtin.assumeAlignment")
167167
BASELINE_LANGUAGE_FEATURE(BuiltinCreateTaskGroupWithFlags, 0, "Builtin.createTaskGroupWithFlags")
168168
BASELINE_LANGUAGE_FEATURE(UnsafeInheritExecutor, 0, "@_unsafeInheritExecutor")
169-
SUPPRESSIBLE_LANGUAGE_FEATURE(PrimaryAssociatedTypes2, 346, "Primary associated types")
169+
BASELINE_LANGUAGE_FEATURE(PrimaryAssociatedTypes2, 346, "Primary associated types")
170170
BASELINE_LANGUAGE_FEATURE(UnavailableFromAsync, 0, "@_unavailableFromAsync")
171171
BASELINE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)")
172172
BASELINE_LANGUAGE_FEATURE(AssociatedTypeAvailability, 0, "Availability on associated types")

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3043,14 +3043,6 @@ static void suppressingFeatureSpecializeAttributeWithAvailability(
30433043
action();
30443044
}
30453045

3046-
static void suppressingFeaturePrimaryAssociatedTypes2(PrintOptions &options,
3047-
llvm::function_ref<void()> action) {
3048-
bool originalPrintPrimaryAssociatedTypes = options.PrintPrimaryAssociatedTypes;
3049-
options.PrintPrimaryAssociatedTypes = false;
3050-
action();
3051-
options.PrintPrimaryAssociatedTypes = originalPrintPrimaryAssociatedTypes;
3052-
}
3053-
30543046
static void
30553047
suppressingFeatureLexicalLifetimes(PrintOptions &options,
30563048
llvm::function_ref<void()> action) {
@@ -3646,10 +3638,7 @@ void PrintAST::visitProtocolDecl(ProtocolDecl *decl) {
36463638
Printer.printName(name);
36473639
});
36483640

3649-
if (Options.PrintPrimaryAssociatedTypes) {
3650-
printPrimaryAssociatedTypes(decl);
3651-
}
3652-
3641+
printPrimaryAssociatedTypes(decl);
36533642
printInheritedFromRequirementSignature(decl, decl);
36543643

36553644
// The trailing where clause is a syntactic thing, which isn't serialized

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,6 @@ static bool usesFeatureSpecializeAttributeWithAvailability(Decl *decl) {
141141
return false;
142142
}
143143

144-
static bool usesFeaturePrimaryAssociatedTypes2(Decl *decl) {
145-
if (auto *protoDecl = dyn_cast<ProtocolDecl>(decl)) {
146-
if (protoDecl->getPrimaryAssociatedTypes().size() > 0)
147-
return true;
148-
}
149-
150-
return false;
151-
}
152-
153144
static bool usesFeatureMacros(Decl *decl) { return isa<MacroDecl>(decl); }
154145

155146
static bool usesFeatureFreestandingExpressionMacros(Decl *decl) {

test/ModuleInterface/parameterized-protocols.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@ public protocol HasPrimaryAssociatedTypes<T, U> {
88
associatedtype U : Equatable
99
}
1010

11-
// CHECK: #if compiler(>=5.3) && $PrimaryAssociatedTypes2
12-
// CHECK-NEXT: public protocol HasPrimaryAssociatedTypes<T, U> {
11+
// CHECK: public protocol HasPrimaryAssociatedTypes<T, U> {
1312
// CHECK-NEXT: associatedtype T : Swift.Collection
1413
// CHECK-NEXT: associatedtype U : Swift.Equatable where Self.U == Self.T.Element
1514
// CHECK-NEXT: }
16-
// CHECK-NEXT: #else
17-
// CHECK-NEXT: public protocol HasPrimaryAssociatedTypes {
18-
// CHECK-NEXT: associatedtype T : Swift.Collection
19-
// CHECK-NEXT: associatedtype U : Swift.Equatable where Self.U == Self.T.Element
20-
// CHECK-NEXT: }
21-
// CHECK-NEXT: #endif

0 commit comments

Comments
 (0)