Skip to content

Commit ad962d8

Browse files
committed
[AST] Allow tuple types with consecutive pack expansions.
1 parent 596edde commit ad962d8

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3136,15 +3136,6 @@ TupleType *TupleType::get(ArrayRef<TupleTypeElt> Fields, const ASTContext &C) {
31363136
properties |= eltTy->getRecursiveProperties();
31373137
}
31383138

3139-
// Enforce an invariant.
3140-
for (unsigned i = 0, e = Fields.size(); i < e; ++i) {
3141-
if (Fields[i].getType()->is<PackExpansionType>()) {
3142-
assert(i == e - 1 || Fields[i + 1].hasName() &&
3143-
"Tuple element with pack expansion type cannot be followed "
3144-
"by an unlabeled element");
3145-
}
3146-
}
3147-
31483139
auto arena = getArena(properties);
31493140

31503141
void *InsertPos = nullptr;

test/Constraints/pack-expansion-expressions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ func prepend<First, Rest...>(value: First, to rest: Rest...) -> (First, Rest...)
88
return (value, rest...)
99
}
1010

11-
func concatenate<T..., U...>(_ first: T..., with second: U...) -> ((T, U)...) {
12-
return ((first, second)...)
11+
func concatenate<T..., U...>(_ first: T..., with second: U...) -> (T..., U...) {
12+
return (first..., second...)
1313
}
1414

1515
func zip<T..., U...>(_ first: T..., with second: U...) -> ((T, U)...) {

0 commit comments

Comments
 (0)