mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Promote PrimaryAssociatedTypes2 feature to the baseline.
This commit is contained in:
@@ -608,12 +608,6 @@ struct PrintOptions {
|
||||
QualifyNestedDeclarations ShouldQualifyNestedDeclarations =
|
||||
QualifyNestedDeclarations::Never;
|
||||
|
||||
/// If true, we print a protocol's primary associated types using the
|
||||
/// primary associated type syntax: `protocol Foo<Type1, ...>`.
|
||||
///
|
||||
/// If false, we print them as ordinary associated types.
|
||||
bool PrintPrimaryAssociatedTypes = true;
|
||||
|
||||
/// Whether or not to print `@attached(extension)` attributes on
|
||||
/// macro declarations. This is used for feature suppression in
|
||||
/// Swift interface printing.
|
||||
|
||||
@@ -166,7 +166,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(SpecializeAttributeWithAvailability, 0, "@_special
|
||||
BASELINE_LANGUAGE_FEATURE(BuiltinAssumeAlignment, 0, "Builtin.assumeAlignment")
|
||||
BASELINE_LANGUAGE_FEATURE(BuiltinCreateTaskGroupWithFlags, 0, "Builtin.createTaskGroupWithFlags")
|
||||
BASELINE_LANGUAGE_FEATURE(UnsafeInheritExecutor, 0, "@_unsafeInheritExecutor")
|
||||
SUPPRESSIBLE_LANGUAGE_FEATURE(PrimaryAssociatedTypes2, 346, "Primary associated types")
|
||||
BASELINE_LANGUAGE_FEATURE(PrimaryAssociatedTypes2, 346, "Primary associated types")
|
||||
BASELINE_LANGUAGE_FEATURE(UnavailableFromAsync, 0, "@_unavailableFromAsync")
|
||||
BASELINE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)")
|
||||
BASELINE_LANGUAGE_FEATURE(AssociatedTypeAvailability, 0, "Availability on associated types")
|
||||
|
||||
@@ -3043,14 +3043,6 @@ static void suppressingFeatureSpecializeAttributeWithAvailability(
|
||||
action();
|
||||
}
|
||||
|
||||
static void suppressingFeaturePrimaryAssociatedTypes2(PrintOptions &options,
|
||||
llvm::function_ref<void()> action) {
|
||||
bool originalPrintPrimaryAssociatedTypes = options.PrintPrimaryAssociatedTypes;
|
||||
options.PrintPrimaryAssociatedTypes = false;
|
||||
action();
|
||||
options.PrintPrimaryAssociatedTypes = originalPrintPrimaryAssociatedTypes;
|
||||
}
|
||||
|
||||
static void
|
||||
suppressingFeatureLexicalLifetimes(PrintOptions &options,
|
||||
llvm::function_ref<void()> action) {
|
||||
@@ -3646,10 +3638,7 @@ void PrintAST::visitProtocolDecl(ProtocolDecl *decl) {
|
||||
Printer.printName(name);
|
||||
});
|
||||
|
||||
if (Options.PrintPrimaryAssociatedTypes) {
|
||||
printPrimaryAssociatedTypes(decl);
|
||||
}
|
||||
|
||||
printPrimaryAssociatedTypes(decl);
|
||||
printInheritedFromRequirementSignature(decl, decl);
|
||||
|
||||
// The trailing where clause is a syntactic thing, which isn't serialized
|
||||
|
||||
@@ -141,15 +141,6 @@ static bool usesFeatureSpecializeAttributeWithAvailability(Decl *decl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool usesFeaturePrimaryAssociatedTypes2(Decl *decl) {
|
||||
if (auto *protoDecl = dyn_cast<ProtocolDecl>(decl)) {
|
||||
if (protoDecl->getPrimaryAssociatedTypes().size() > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool usesFeatureMacros(Decl *decl) { return isa<MacroDecl>(decl); }
|
||||
|
||||
static bool usesFeatureFreestandingExpressionMacros(Decl *decl) {
|
||||
|
||||
@@ -8,14 +8,7 @@ public protocol HasPrimaryAssociatedTypes<T, U> {
|
||||
associatedtype U : Equatable
|
||||
}
|
||||
|
||||
// CHECK: #if compiler(>=5.3) && $PrimaryAssociatedTypes2
|
||||
// CHECK-NEXT: public protocol HasPrimaryAssociatedTypes<T, U> {
|
||||
// CHECK: public protocol HasPrimaryAssociatedTypes<T, U> {
|
||||
// CHECK-NEXT: associatedtype T : Swift.Collection
|
||||
// CHECK-NEXT: associatedtype U : Swift.Equatable where Self.U == Self.T.Element
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #else
|
||||
// CHECK-NEXT: public protocol HasPrimaryAssociatedTypes {
|
||||
// CHECK-NEXT: associatedtype T : Swift.Collection
|
||||
// CHECK-NEXT: associatedtype U : Swift.Equatable where Self.U == Self.T.Element
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #endif
|
||||
|
||||
Reference in New Issue
Block a user