Skip to content

Commit b517a44

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

File tree

3 files changed

+9
-48
lines changed

3 files changed

+9
-48
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ LANGUAGE_FEATURE(AttachedMacros, 389, "Attached macros")
178178
LANGUAGE_FEATURE(ExtensionMacros, 402, "Extension macros")
179179
LANGUAGE_FEATURE(MoveOnly, 390, "noncopyable types")
180180
LANGUAGE_FEATURE(MoveOnlyResilientTypes, 390, "non-@frozen noncopyable types with library evolution")
181-
LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs")
181+
BASELINE_LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs")
182182
SUPPRESSIBLE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations")
183183
LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros")
184184
SUPPRESSIBLE_LANGUAGE_FEATURE(RetroactiveAttribute, 364, "@retroactive")

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -223,29 +223,6 @@ static bool hasParameterPacks(Decl *decl) {
223223
return false;
224224
}
225225

226-
/// A declaration needs the $ParameterPacks feature if it declares a
227-
/// generic parameter pack, or if its type references a generic nominal
228-
/// or type alias which declares a generic parameter pack.
229-
static bool usesFeatureParameterPacks(Decl *decl) {
230-
if (hasParameterPacks(decl))
231-
return true;
232-
233-
if (auto *valueDecl = dyn_cast<ValueDecl>(decl)) {
234-
if (valueDecl->getInterfaceType().findIf([&](Type t) {
235-
if (auto *alias = dyn_cast<TypeAliasType>(t.getPointer()))
236-
return hasParameterPacks(alias->getDecl());
237-
if (auto *nominal = t->getAnyNominal())
238-
return hasParameterPacks(nominal);
239-
240-
return false;
241-
})) {
242-
return true;
243-
}
244-
}
245-
246-
return false;
247-
}
248-
249226
static bool usesFeatureLexicalLifetimes(Decl *decl) {
250227
return decl->getAttrs().hasAttribute<EagerMoveAttr>() ||
251228
decl->getAttrs().hasAttribute<NoEagerMoveAttr>() ||

test/ModuleInterface/pack_expansion_type.swift

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44

55
/// Requirements
66

7-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
8-
// CHECK-NEXT: public func variadicFunction<each T, each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) where (repeat (each T, each U)) : Any
7+
// CHECK: public func variadicFunction<each T, each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) where (repeat (each T, each U)) : Any
98
public func variadicFunction<each T, each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) {}
10-
// CHECK-NEXT: #endif
119

12-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
13-
// CHECK-NEXT: public func variadicFunctionWithRequirement<each T>(t: repeat each T) where repeat each T : Swift.Equatable
10+
// CHECK: public func variadicFunctionWithRequirement<each T>(t: repeat each T) where repeat each T : Swift.Equatable
1411
public func variadicFunctionWithRequirement<each T: Equatable>(t: repeat each T) {}
15-
// CHECK-NEXT: #endif
1612

17-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
18-
// CHECK-NEXT: public struct VariadicType<each T> {
13+
// CHECK: public struct VariadicType<each T> {
1914
public struct VariadicType<each T> {
2015
// CHECK: public func variadicMethod<each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) where (repeat (each T, each U)) : Any
2116
public func variadicMethod<each U>(t: repeat each T, u: repeat each U) -> (repeat (each T, each U)) {}
@@ -24,7 +19,6 @@ public struct VariadicType<each T> {
2419
public func returnsSelf() -> Self {}
2520
}
2621
// CHECK: }
27-
// CHECK-NEXT: #endif
2822

2923
// The second requirement should not be prefixed with 'repeat'
3024
// CHECK: public struct SameTypeReq<T, each U> where T : Swift.Sequence, T.Element == PackExpansionType.VariadicType<repeat each U> {
@@ -39,27 +33,17 @@ public func returnsVariadicType() -> VariadicType< > {}
3933
// CHECK: public func returnsVariadicType() -> PackExpansionType.VariadicType<Swift.Int, Swift.String, Swift.Float>
4034
public func returnsVariadicType() -> VariadicType<Int, String, Float> {}
4135

42-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
43-
// CHECK-NEXT: public func returnsVariadicType<each T>() -> PackExpansionType.VariadicType<repeat each T>
36+
// CHECK: public func returnsVariadicType<each T>() -> PackExpansionType.VariadicType<repeat each T>
4437
public func returnsVariadicType<each T>() -> VariadicType<repeat each T> {}
45-
// CHECK-NEXT: #endif
4638

47-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
48-
// CHECK-NEXT: public typealias VariadicAlias<each T> = PackExpansionType.VariadicType<repeat Swift.Array<each T>>
49-
// CHECK-NEXT: #endif
39+
// CHECK: public typealias VariadicAlias<each T> = PackExpansionType.VariadicType<repeat Swift.Array<each T>>
5040
public typealias VariadicAlias<each T> = VariadicType<repeat Array<each T>>
5141

52-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
53-
// CHECK-NEXT: public func returnsVariadicAlias() -> PackExpansionType.VariadicAlias<>
54-
// CHECK-NEXT: #endif
42+
// CHECK: public func returnsVariadicAlias() -> PackExpansionType.VariadicAlias<>
5543
public func returnsVariadicAlias() -> VariadicAlias< > {}
5644

57-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
58-
// CHECK-NEXT: public func returnsVariadicAlias() -> PackExpansionType.VariadicAlias<Swift.Int, Swift.String, Swift.Float>
59-
// CHECK-NEXT: #endif
45+
// CHECK: public func returnsVariadicAlias() -> PackExpansionType.VariadicAlias<Swift.Int, Swift.String, Swift.Float>
6046
public func returnsVariadicAlias() -> VariadicAlias<Int, String, Float> {}
6147

62-
// CHECK: #if compiler(>=5.3) && $ParameterPacks
63-
// CHECK-NEXT: public func returnsVariadicAlias<each T>() -> PackExpansionType.VariadicAlias<repeat each T>
64-
// CHECK-NEXT: #endif
48+
// CHECK: public func returnsVariadicAlias<each T>() -> PackExpansionType.VariadicAlias<repeat each T>
6549
public func returnsVariadicAlias<each T>() -> VariadicAlias<repeat each T> {}

0 commit comments

Comments
 (0)