Skip to content

Commit 218aeeb

Browse files
committed
[AST/Sema] SE-0487: Remove @preEnumExtensibility attribute
(cherry picked from commit 0444d29)
1 parent 277be31 commit 218aeeb

File tree

7 files changed

+3
-22
lines changed

7 files changed

+3
-22
lines changed

include/swift/AST/DeclAttr.def

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,13 +887,9 @@ SIMPLE_DECL_ATTR(concurrent, Concurrent,
887887
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove | UnconstrainedInABIAttr,
888888
170)
889889

890-
SIMPLE_DECL_ATTR(preEnumExtensibility, PreEnumExtensibility,
891-
OnEnum,
892-
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIBreakingToRemove | UnconstrainedInABIAttr,
893-
171)
894-
DECL_ATTR_FEATURE_REQUIREMENT(PreEnumExtensibility, NonexhaustiveAttribute)
890+
// Unused '171': Used to be `@preEnumExtensibility`
895891

896-
LAST_DECL_ATTR(PreEnumExtensibility)
892+
LAST_DECL_ATTR(Concurrent)
897893

898894
#undef DECL_ATTR_ALIAS
899895
#undef CONTEXTUAL_DECL_ATTR_ALIAS

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8724,9 +8724,6 @@ ERROR(nonexhaustive_attr_on_internal_type,none,
87248724
"%select{private|fileprivate|internal|%error|%error|%error}1",
87258725
(DeclName, AccessLevel))
87268726

8727-
ERROR(pre_enum_extensibility_without_nonexhaustive,none,
8728-
"%0 can only be used together with '@nonexhaustive' attribute", (DeclAttribute))
8729-
87308727
//===----------------------------------------------------------------------===//
87318728
// MARK: `using` declaration
87328729
//===----------------------------------------------------------------------===//

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5066,7 +5066,6 @@ class PrintAttribute : public AttributeVisitor<PrintAttribute, void, Label>,
50665066
TRIVIAL_ATTR_PRINTER(WeakLinked, weak_linked)
50675067
TRIVIAL_ATTR_PRINTER(Nonexhaustive, nonexhaustive)
50685068
TRIVIAL_ATTR_PRINTER(Concurrent, concurrent)
5069-
TRIVIAL_ATTR_PRINTER(PreEnumExtensibility, preEnumExtensibility)
50705069

50715070
#undef TRIVIAL_ATTR_PRINTER
50725071

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3328,8 +3328,7 @@ suppressingFeatureAddressableTypes(PrintOptions &options,
33283328
static void
33293329
suppressingFeatureNonexhaustiveAttribute(PrintOptions &options,
33303330
llvm::function_ref<void()> action) {
3331-
ExcludeAttrRAII scope1(options.ExcludeAttrList, DeclAttrKind::Nonexhaustive);
3332-
ExcludeAttrRAII scope2(options.ExcludeAttrList, DeclAttrKind::PreEnumExtensibility);
3331+
ExcludeAttrRAII scope(options.ExcludeAttrList, DeclAttrKind::Nonexhaustive);
33333332
action();
33343333
}
33353334

lib/ASTGen/Sources/ASTGen/DeclAttrs.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ extension ASTGenVisitor {
229229
.eagerMove,
230230
.exported,
231231
.nonexhaustive,
232-
.preEnumExtensibility,
233232
.discardableResult,
234233
.disfavoredOverload,
235234
.dynamicMemberLookup,

lib/Sema/TypeCheckAttr.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
258258
}
259259
}
260260

261-
void visitPreEnumExtensibilityAttr(PreEnumExtensibilityAttr *attr) {
262-
if (!D->getAttrs().hasAttribute<NonexhaustiveAttr>()) {
263-
diagnoseAndRemoveAttr(
264-
attr, diag::pre_enum_extensibility_without_nonexhaustive, attr);
265-
return;
266-
}
267-
}
268-
269261
void visitAlignmentAttr(AlignmentAttr *attr) {
270262
// Alignment must be a power of two.
271263
auto value = attr->getValue();

lib/Sema/TypeCheckDeclOverride.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,6 @@ namespace {
16171617
UNINTERESTING_ATTR(Optimize)
16181618
UNINTERESTING_ATTR(Exclusivity)
16191619
UNINTERESTING_ATTR(Nonexhaustive)
1620-
UNINTERESTING_ATTR(PreEnumExtensibility)
16211620
UNINTERESTING_ATTR(NoLocks)
16221621
UNINTERESTING_ATTR(NoAllocation)
16231622
UNINTERESTING_ATTR(NoRuntime)

0 commit comments

Comments
 (0)