Commit e334d754 authored by Shashwat Dixit's avatar Shashwat Dixit Committed by Milian Wolff
Browse files

Do not add return type to constructors declaration when editing definition in signature assistant.

BUG: 365420

Reviewers: kfunk, mwolff, #kdevelop, brauch

Reviewed By: mwolff, #kdevelop, brauch

Subscribers: brauch, apol, #kdevelop, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D11291
parent 335786a1
......@@ -48,7 +48,7 @@ Declaration *getDeclarationAtCursor(const KTextEditor::Cursor &cursor, const QUr
bool isConstructor(const Declaration *functionDecl)
{
auto classFun = dynamic_cast<const ClassFunctionDeclaration*>(functionDecl);
auto classFun = dynamic_cast<const ClassFunctionDeclaration*>(DUChainUtils::declarationForDefinition(const_cast<Declaration*>(functionDecl)));
return classFun && classFun->isConstructor();
}
......
......@@ -484,6 +484,14 @@ void TestAssistants::testSignatureAssistant_data()
<< "class Foo { Foo(char c); };"
<< "Foo::Foo(char c)\n{}";
// see https://bugs.kde.org/show_bug.cgi?id=365420
QTest::newRow("no_retval_on_ctor_while_editing_definition")
<< "class Foo {\nFoo(int a); \n};"
<< "Foo::Foo(int a)\n{}"
<< (QList<StateChange>() << StateChange(Testbed::CppDoc, Range(0,13,0,14), QStringLiteral("b"), SHOULD_ASSIST))
<< "class Foo {\nFoo(int b); \n};"
<< "Foo::Foo(int b)\n{}";
// see https://bugs.kde.org/show_bug.cgi?id=298511
QTest::newRow("change_return_type_header")
<< "struct Foo { int bar(); };"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment