Skip to content

Commit 6aa44a1

Browse files
committed
[AST] Remove @_typeSequence attribute
This is no longer needed now that we have the ellipsis spelling.
1 parent 48ea933 commit 6aa44a1

11 files changed

+4
-71
lines changed

include/swift/AST/ASTContext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ class ASTContext final {
13571357
/// Get a generic signature where the generic parameter τ_d_i represents
13581358
/// the element of the pack generic parameter τ_d_i… in \p baseGenericSig.
13591359
///
1360-
/// This drops the @_typeSequence attribute from each generic parameter,
1360+
/// This drops the parameter pack bit from each generic parameter,
13611361
/// and converts same-element requirements to same-type requirements.
13621362
CanGenericSignature getOpenedElementSignature(CanGenericSignature baseGenericSig);
13631363

include/swift/AST/Attr.h

-14
Original file line numberDiff line numberDiff line change
@@ -2190,20 +2190,6 @@ class NonSendableAttr : public DeclAttribute {
21902190
}
21912191
};
21922192

2193-
/// The @_typeSequence attribute, which treats a generic param decl as a variadic
2194-
/// sequence of value/type pairs.
2195-
class TypeSequenceAttr : public DeclAttribute {
2196-
TypeSequenceAttr(SourceLoc atLoc, SourceRange Range);
2197-
2198-
public:
2199-
static TypeSequenceAttr *create(ASTContext &Ctx, SourceLoc atLoc,
2200-
SourceRange Range);
2201-
2202-
static bool classof(const DeclAttribute *DA) {
2203-
return DA->getKind() == DAK_TypeSequence;
2204-
}
2205-
};
2206-
22072193
/// The @_unavailableFromAsync attribute, used to make function declarations
22082194
/// unavailable from async contexts.
22092195
class UnavailableFromAsyncAttr : public DeclAttribute {

include/swift/AST/DiagnosticsSema.def

-8
Original file line numberDiff line numberDiff line change
@@ -6482,14 +6482,6 @@ ERROR(noimplicitcopy_attr_valid_only_on_local_let_params,
64826482
ERROR(noimplicitcopy_attr_invalid_in_generic_context,
64836483
none, "'@_noImplicitCopy' attribute cannot be applied to entities in generic contexts", ())
64846484

6485-
//------------------------------------------------------------------------------
6486-
// MARK: variadics
6487-
//------------------------------------------------------------------------------
6488-
6489-
ERROR(type_sequence_on_non_generic_param, none,
6490-
"'@_typeSequence' must appear on a generic parameter",
6491-
())
6492-
64936485
//------------------------------------------------------------------------------
64946486
// MARK: Type inference from default expressions
64956487
//------------------------------------------------------------------------------

lib/AST/ASTContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ struct ASTContext::Implementation {
352352
ExistentialSignatures;
353353

354354
/// The element signature for a generic signature, constructed by dropping
355-
/// @_typeSequence attributes from generic parameters.
355+
/// the parameter pack bit from generic parameters.
356356
llvm::DenseMap<const GenericSignatureImpl *,
357357
CanGenericSignature> ElementSignatures;
358358

lib/AST/Attr.cpp

-16
Original file line numberDiff line numberDiff line change
@@ -1264,11 +1264,6 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
12641264
break;
12651265
}
12661266

1267-
case DAK_TypeSequence: {
1268-
Printer.printAttrName("@_typeSequence");
1269-
break;
1270-
}
1271-
12721267
case DAK_UnavailableFromAsync: {
12731268
Printer.printAttrName("@_unavailableFromAsync");
12741269
const UnavailableFromAsyncAttr *attr = cast<UnavailableFromAsyncAttr>(this);
@@ -1454,8 +1449,6 @@ StringRef DeclAttribute::getAttrName() const {
14541449
return "derivative";
14551450
case DAK_Transpose:
14561451
return "transpose";
1457-
case DAK_TypeSequence:
1458-
return "_typeSequence";
14591452
case DAK_UnavailableFromAsync:
14601453
return "_unavailableFromAsync";
14611454
case DAK_BackDeploy:
@@ -2289,15 +2282,6 @@ bool CustomAttr::isArgUnsafe() const {
22892282
return isArgUnsafeBit;
22902283
}
22912284

2292-
TypeSequenceAttr::TypeSequenceAttr(SourceLoc atLoc, SourceRange range)
2293-
: DeclAttribute(DAK_TypeSequence, atLoc, range, /*Implicit=*/false) {}
2294-
2295-
TypeSequenceAttr *TypeSequenceAttr::create(ASTContext &Ctx, SourceLoc atLoc,
2296-
SourceRange range) {
2297-
void *mem = Ctx.Allocate(sizeof(TypeSequenceAttr), alignof(TypeSequenceAttr));
2298-
return new (mem) TypeSequenceAttr(atLoc, range);
2299-
}
2300-
23012285
const DeclAttribute *
23022286
DeclAttributes::getEffectiveSendableAttr() const {
23032287
const NonSendableAttr *assumedAttr = nullptr;

lib/Parse/ParseDecl.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -3050,15 +3050,6 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
30503050
*name, AtLoc, range, /*implicit*/ false));
30513051
break;
30523052
}
3053-
case DAK_TypeSequence: {
3054-
if (Context.LangOpts.hasFeature(Feature::VariadicGenerics)) {
3055-
auto range = SourceRange(Loc, Tok.getRange().getStart());
3056-
Attributes.add(TypeSequenceAttr::create(Context, AtLoc, range));
3057-
} else {
3058-
DiscardAttribute = true;
3059-
}
3060-
break;
3061-
}
30623053

30633054
case DAK_UnavailableFromAsync: {
30643055
StringRef message;

lib/Parse/ParseGeneric.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ Parser::parseGenericParametersBeforeWhere(SourceLoc LAngleLoc,
107107
Inherited.push_back({Ty.get()});
108108
}
109109

110-
const bool isParameterPack =
111-
attributes.getAttribute<TypeSequenceAttr>() != nullptr ||
112-
EllipsisLoc.isValid();
110+
const bool isParameterPack = EllipsisLoc.isValid();
113111
auto *Param = GenericTypeParamDecl::createParsed(
114112
CurDeclContext, Name, NameLoc, EllipsisLoc,
115113
/*index*/ GenericParams.size(), isParameterPack);

lib/Sema/TypeCheckAttr.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
287287
void visitDynamicReplacementAttr(DynamicReplacementAttr *attr);
288288
void visitTypeEraserAttr(TypeEraserAttr *attr);
289289
void visitImplementsAttr(ImplementsAttr *attr);
290-
void visitTypeSequenceAttr(TypeSequenceAttr *attr);
291290
void visitNoMetadataAttr(NoMetadataAttr *attr);
292291

293292
void visitFrozenAttr(FrozenAttr *attr);
@@ -4065,13 +4064,6 @@ AttributeChecker::visitSPIOnlyAttr(SPIOnlyAttr *attr) {
40654064
}
40664065
}
40674066

4068-
void AttributeChecker::visitTypeSequenceAttr(TypeSequenceAttr *attr) {
4069-
if (!isa<GenericTypeParamDecl>(D)) {
4070-
attr->setInvalid();
4071-
diagnoseAndRemoveAttr(attr, diag::type_sequence_on_non_generic_param);
4072-
}
4073-
}
4074-
40754067
void AttributeChecker::visitNoMetadataAttr(NoMetadataAttr *attr) {
40764068
if (!Ctx.LangOpts.hasFeature(Feature::LayoutPrespecialization)) {
40774069
auto error =

lib/Sema/TypeCheckDeclOverride.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,6 @@ namespace {
16101610
UNINTERESTING_ATTR(NoImplicitCopy)
16111611
UNINTERESTING_ATTR(UnavailableFromAsync)
16121612

1613-
UNINTERESTING_ATTR(TypeSequence)
16141613
UNINTERESTING_ATTR(NoMetadata)
16151614
UNINTERESTING_ATTR(CompileTimeConst)
16161615

lib/Serialization/ModuleFormat.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5858
/// describe what change you made. The content of this comment isn't important;
5959
/// it just ensures a conflict if two people change the module format.
6060
/// Don't worry about adhering to the 80-column limit for this line.
61-
const uint16_t SWIFTMODULE_VERSION_MINOR =
62-
715; // New test_specification instruction
61+
const uint16_t SWIFTMODULE_VERSION_MINOR = 716; // remove @_typeSequence
6362

6463
/// A standard hash seed used for all string hashes in a serialized module.
6564
///
@@ -2064,8 +2063,6 @@ namespace decls_block {
20642063
BCArray<BCFixed<1>> // Transposed parameter indices' bitvector.
20652064
>;
20662065

2067-
using TypeSequenceDeclAttrLayout = BCRecordLayout<TypeSequence_DECL_ATTR>;
2068-
20692066
#define SIMPLE_DECL_ATTR(X, CLASS, ...) \
20702067
using CLASS##DeclAttrLayout = BCRecordLayout< \
20712068
CLASS##_DECL_ATTR, \

lib/Serialization/Serialization.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -2857,12 +2857,6 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
28572857
return;
28582858
}
28592859

2860-
case DAK_TypeSequence: {
2861-
auto abbrCode = S.DeclTypeAbbrCodes[TypeSequenceDeclAttrLayout::Code];
2862-
TypeSequenceDeclAttrLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode);
2863-
return;
2864-
}
2865-
28662860
case DAK_UnavailableFromAsync: {
28672861
auto abbrCode =
28682862
S.DeclTypeAbbrCodes[UnavailableFromAsyncDeclAttrLayout::Code];

0 commit comments

Comments
 (0)