forked from qt-creator/qt-creator
CppEditor: Properly handle function types as template arguments
... when creating getters and setters. Fixes: QTCREATORBUG-27133 Change-Id: Ia77147a270fb1229c765ff9d5f03aa243d51fe97 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -3362,6 +3362,43 @@ void QuickfixTest::testGenerateGetterSetterOnlySetterHeaderFileWithIncludeGuard(
|
||||
QuickFixOperationTest(testDocuments, &factory, ProjectExplorer::HeaderPaths(), 0);
|
||||
}
|
||||
|
||||
void QuickfixTest::testGenerateGetterFunctionAsTemplateArg()
|
||||
{
|
||||
QList<TestDocumentPtr> testDocuments;
|
||||
const QByteArray original = R"(
|
||||
template<typename T> class TS {};
|
||||
template<typename T, typename U> class TS<T(U)> {};
|
||||
|
||||
class S2 {
|
||||
TS<int(int)> @member;
|
||||
};
|
||||
)";
|
||||
const QByteArray expected = R"(
|
||||
template<typename T> class TS {};
|
||||
template<typename T, typename U> class TS<T(U)> {};
|
||||
|
||||
class S2 {
|
||||
TS<int(int)> member;
|
||||
|
||||
public:
|
||||
const TS<int (int)> &getMember() const
|
||||
{
|
||||
return member;
|
||||
}
|
||||
};
|
||||
)";
|
||||
|
||||
testDocuments << CppTestDocument::create("file.h", original, expected);
|
||||
|
||||
QuickFixSettings s;
|
||||
s->getterOutsideClassFrom = 0;
|
||||
s->getterInCppFileFrom = 0;
|
||||
s->getterNameTemplate = "get<Name>";
|
||||
|
||||
GenerateGetterSetter factory;
|
||||
QuickFixOperationTest(testDocuments, &factory, ProjectExplorer::HeaderPaths(), 1);
|
||||
}
|
||||
|
||||
class CppCodeStyleSettingsChanger {
|
||||
public:
|
||||
CppCodeStyleSettingsChanger(const CppCodeStyleSettings &settings);
|
||||
|
||||
Reference in New Issue
Block a user