forked from qt-creator/qt-creator
CppEditor: Fix "decl from def" quickfix with templated return type
We must treat return and parameters types of the function differently from the function itself with regards to template parameters. This was already done for parameters, but not for the return type. Fixes: QTCREATORBUG-26248 Change-Id: I44cf6f0bda7b5e3c38f9f73e13f51f2c12ab7dc4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4614,7 +4614,7 @@ void QuickfixTest::testInsertDefFromDeclTemplateFunction()
|
||||
"};\n"
|
||||
"\n"
|
||||
"template<class T>\n"
|
||||
"void Foo::func<T>()\n"
|
||||
"void Foo::func()\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"}\n";
|
||||
@@ -4939,6 +4939,28 @@ void QuickfixTest::testInsertDeclFromDefTemplateFuncInt()
|
||||
QuickFixOperationTest(singleDocument(original, expected), &factory, {}, 0);
|
||||
}
|
||||
|
||||
void QuickfixTest::testInsertDeclFromDefTemplateReturnType()
|
||||
{
|
||||
QByteArray original =
|
||||
"class Foo\n"
|
||||
"{\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"std::vector<int> Foo::fu@nc() const {}\n";
|
||||
|
||||
QByteArray expected =
|
||||
"class Foo\n"
|
||||
"{\n"
|
||||
"public:\n"
|
||||
" std::vector<int> func() const;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"std::vector<int> Foo::func() const {}\n";
|
||||
|
||||
InsertDeclFromDef factory;
|
||||
QuickFixOperationTest(singleDocument(original, expected), &factory, {}, 0);
|
||||
}
|
||||
|
||||
void QuickfixTest::testInsertDeclFromDefNotTriggeredForTemplateFunc()
|
||||
{
|
||||
QByteArray contents =
|
||||
|
||||
Reference in New Issue
Block a user