Skip to content

Commit aa87afd

Browse files
committed
AST: Fix printing of BuiltinFixedArrayType
1 parent 3c6b2a2 commit aa87afd

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6241,9 +6241,20 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
62416241
ASTPRINTER_PRINT_BUILTINTYPE(BuiltinIntegerType)
62426242
ASTPRINTER_PRINT_BUILTINTYPE(BuiltinFloatType)
62436243
ASTPRINTER_PRINT_BUILTINTYPE(BuiltinUnboundGenericType)
6244-
ASTPRINTER_PRINT_BUILTINTYPE(BuiltinFixedArrayType)
62456244
#undef ASTPRINTER_PRINT_BUILTINTYPE
62466245

6246+
void visitBuiltinFixedArrayType(BuiltinFixedArrayType *T,
6247+
NonRecursivePrintOptions nrOptions) {
6248+
SmallString<32> buffer;
6249+
T->getTypeName(buffer);
6250+
Printer << buffer;
6251+
Printer << "<";
6252+
visit(T->getSize());
6253+
Printer << ", ";
6254+
visit(T->getElementType());
6255+
Printer << ">";
6256+
}
6257+
62476258
void visitSILTokenType(SILTokenType *T,
62486259
NonRecursivePrintOptions nrOptions) {
62496260
Printer << BUILTIN_TYPE_NAME_SILTOKEN;

lib/AST/Builtins.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,16 +3593,9 @@ StringRef BuiltinType::getTypeName(SmallVectorImpl<char> &result,
35933593
}
35943594
break;
35953595
}
3596-
case BuiltinTypeKind::BuiltinFixedArray: {
3597-
auto bfa = cast<BuiltinFixedArrayType>(this);
3598-
printer << MAYBE_GET_NAMESPACED_BUILTIN(BUILTIN_TYPE_NAME_FIXEDARRAY)
3599-
<< '<';
3600-
bfa->getSize()->print(printer);
3601-
printer << ", ";
3602-
bfa->getElementType()->print(printer);
3603-
printer << '>';
3596+
case BuiltinTypeKind::BuiltinFixedArray:
3597+
printer << MAYBE_GET_NAMESPACED_BUILTIN(BUILTIN_TYPE_NAME_FIXEDARRAY);
36043598
break;
3605-
}
36063599
case BuiltinTypeKind::BuiltinUnboundGeneric: {
36073600
auto bug = cast<BuiltinUnboundGenericType>(this);
36083601
printer << MAYBE_GET_NAMESPACED_BUILTIN(bug->getBuiltinTypeName());

0 commit comments

Comments
 (0)