Skip to content

Commit ad31fa3

Browse files
committed
AST: Fix printing of one-element tuples containing a pack expansion
1 parent 0f26d02 commit ad31fa3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5552,9 +5552,8 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
55525552
}
55535553

55545554
void visitPackExpansionType(PackExpansionType *T) {
5555-
Printer << "(";
55565555
visit(T->getPatternType());
5557-
Printer << "..." << ")";
5556+
Printer << "...";
55585557
}
55595558

55605559
void visitTupleType(TupleType *T) {
@@ -5563,7 +5562,8 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
55635562

55645563
// Single-element tuples can only appear in SIL mode.
55655564
if (T->getNumElements() == 1 &&
5566-
!T->getElement(0).hasName()) {
5565+
!T->getElement(0).hasName() &&
5566+
!T->getElementType(0)->is<PackExpansionType>()) {
55675567
Printer << "@tuple ";
55685568
}
55695569

0 commit comments

Comments
 (0)