Skip to content

Commit b71e73d

Browse files
committed
AST: Promote RetroactiveAttribute feature to baseline.
1 parent e7ae787 commit b71e73d

File tree

4 files changed

+1
-37
lines changed

4 files changed

+1
-37
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ BASELINE_LANGUAGE_FEATURE(MoveOnlyResilientTypes, 390, "non-@frozen noncopyable
181181
BASELINE_LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs")
182182
BASELINE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations")
183183
BASELINE_LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros")
184-
SUPPRESSIBLE_LANGUAGE_FEATURE(RetroactiveAttribute, 364, "@retroactive")
184+
BASELINE_LANGUAGE_FEATURE(RetroactiveAttribute, 364, "@retroactive")
185185
BASELINE_LANGUAGE_FEATURE(ExtensionMacroAttr, 0, "@attached(extension)")
186186
BASELINE_LANGUAGE_FEATURE(TypedThrows, 413, "Typed throws")
187187
BASELINE_LANGUAGE_FEATURE(OptionalIsolatedParameters, 420, "Optional isolated parameters")

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,14 +3035,6 @@ static void suppressingFeatureSpecializeAttributeWithAvailability(
30353035
action();
30363036
}
30373037

3038-
static void suppressingFeatureRetroactiveAttribute(
3039-
PrintOptions &options,
3040-
llvm::function_ref<void()> action) {
3041-
llvm::SaveAndRestore<PrintOptions> originalOptions(options);
3042-
options.ExcludeAttrList.push_back(TypeAttrKind::Retroactive);
3043-
action();
3044-
}
3045-
30463038
static void suppressingFeatureIsolatedAny(PrintOptions &options,
30473039
llvm::function_ref<void()> action) {
30483040
llvm::SaveAndRestore<bool> scope(options.SuppressIsolatedAny, true);

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,6 @@ static bool usesFeatureSpecializeAttributeWithAvailability(Decl *decl) {
6363
return false;
6464
}
6565

66-
static bool usesFeatureRetroactiveAttribute(Decl *decl) {
67-
auto ext = dyn_cast<ExtensionDecl>(decl);
68-
if (!ext)
69-
return false;
70-
71-
return llvm::any_of(
72-
ext->getInherited().getEntries(),
73-
[](const InheritedEntry &entry) { return entry.isRetroactive(); });
74-
}
75-
7666
static bool usesFeatureAssociatedTypeImplements(Decl *decl) {
7767
return isa<TypeDecl>(decl) && decl->getAttrs().hasAttribute<ImplementsAttr>();
7868
}

test/ModuleInterface/retroactive-conformances.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,12 @@
22
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name Test
33
// RUN: %FileCheck %s < %t.swiftinterface
44

5-
// CHECK: #if compiler(>=5.3) && $RetroactiveAttribute
65
// CHECK: extension Swift.Int : @retroactive Swift.Identifiable {
76
// CHECK: public var id: Swift.Int {
87
// CHECK: get
98
// CHECK: }
109
// CHECK: public typealias ID = Swift.Int
1110
// CHECK: }
12-
// CHECK: #else
13-
// CHECK: extension Swift.Int : Swift.Identifiable {
14-
// CHECK: public var id: Swift.Int {
15-
// CHECK: get
16-
// CHECK: }
17-
// CHECK: public typealias ID = Swift.Int
18-
// CHECK: }
19-
// CHECK: #endif
2011
extension Int: @retroactive Identifiable {
2112
public var id: Int { self }
2213
}
23-
24-
// CHECK: #if compiler(>=5.3) && $RetroactiveAttribute
25-
// CHECK: extension Swift.String : @retroactive Swift.Identifiable {
26-
// CHECK-NOT: #else
27-
// CHECK: #endif
28-
@_disallowFeatureSuppression(RetroactiveAttribute)
29-
extension String: @retroactive Identifiable {
30-
public var id: String { self }
31-
}

0 commit comments

Comments
 (0)