CppEditor: Fix pretty-printing of auto type

Task-number: QTCREATORBUG-31678
Change-Id: I2c1684c71315d50c98f451b280fbfd08b5d8d3e8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2024-12-05 12:46:17 +01:00
parent 0958fedbdf
commit 9969046093
2 changed files with 6 additions and 3 deletions

View File

@@ -116,6 +116,9 @@ void TypePrettyPrinter::visit(UndefinedType *)
_text.prepend(QLatin1String("signed")); _text.prepend(QLatin1String("signed"));
else if (_fullySpecifiedType.isUnsigned()) else if (_fullySpecifiedType.isUnsigned())
_text.prepend(QLatin1String("unsigned")); _text.prepend(QLatin1String("unsigned"));
} else if (_fullySpecifiedType.isAuto()) {
prependSpaceUnlessBracket();
_text.prepend("auto");
} }
prependCv(_fullySpecifiedType); prependCv(_fullySpecifiedType);

View File

@@ -1883,17 +1883,17 @@ foo::foo2::MyType<int> foo::foo2::bar()
QByteArray original = QByteArray original =
"class Foo\n" "class Foo\n"
"{\n" "{\n"
" template<class U>\n" " template<class U, auto N>\n"
" void fun@c();\n" " void fun@c();\n"
"};\n"; "};\n";
QByteArray expected = QByteArray expected =
"class Foo\n" "class Foo\n"
"{\n" "{\n"
" template<class U>\n" " template<class U, auto N>\n"
" void fun@c();\n" " void fun@c();\n"
"};\n" "};\n"
"\n" "\n"
"template<class U>\n" "template<class U, auto N>\n"
"inline void Foo::func()\n" "inline void Foo::func()\n"
"{\n" "{\n"
"\n" "\n"