Bug 365420 - Usage of "Adapt signature" to rename argument in constructor inserts keyword "void" in its declaration
Summary: Usage of "Adapt signature" to rename argument in constructor inserts keyword ...
Status: REOPENED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (other bugs)
Version First Reported In: 5.3.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 375276 375277 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-07-11 21:03 UTC by Piotr Mierzwinski
Modified: 2019-01-03 22:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.2.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Mierzwinski 2016-07-11 21:03:37 UTC
I rename argument in constructor definition (cpp file). After choosing "Update declaration signature" in "Adapt Signature" helper I get constructor as void type in declaration (header).

There is code
cpp file:
MyClass::MyClass( int *pointer, const QString &string )
{

}

header file:
	MyClass( int *pointer, const QString &string );

For example I rename string to string2 and chose  "Update declaration signature" in "Adapt Signature".

Reproducible: Always

Steps to Reproduce:
1. Rename one of parameter in constructor
2. Choose "Update declaration signature" in "Adapt Signature"
3. Check header file

Actual Results:  
MyClass::MyClass( int *pointer, const QString &string2 )
{

}

header file:
	void MyClass ( int *pointer, const QString &string2 );

Expected Results:  
MyClass::MyClass( int *pointer, const QString &string2 )
{

}

header file:
	 MyClass ( int *pointer, const QString &string );

KDevelop and KDevPlatform cloned and built from branch 5.0, at 08-07-2016
Plasma 5.7.0, KFrameworks 5.23, Qt-5.7
Comment 1 Kevin Funk 2017-03-03 12:01:46 UTC
*** Bug 375276 has been marked as a duplicate of this bug. ***
Comment 2 Piotr Mierzwinski 2017-03-04 19:24:57 UTC
I tested this in KDevelop 5.0.4 and bug still persists.
Comment 3 Milian Wolff 2018-03-15 10:44:08 UTC
Git commit e334d754bf510bdf21368858d8494adf3622fb16 by Milian Wolff, on behalf of Shashwat Dixit.
Committed on 15/03/2018 at 10:40.
Pushed by mwolff into branch 'master'.

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

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

M  +1    -1    plugins/clang/codegen/adaptsignatureassistant.cpp
M  +8    -0    plugins/clang/tests/test_assistants.cpp

https://commits.kde.org/kdevelop/e334d754bf510bdf21368858d8494adf3622fb16
Comment 4 Kevin Funk 2018-03-15 18:47:49 UTC
Git commit 3f99e3deefbe3b77ba023bf09b69d8da3ca815fc by Kevin Funk, on behalf of Shashwat Dixit.
Committed on 15/03/2018 at 18:39.
Pushed by kfunk into branch '5.2'.

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

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

(cherry picked from commit e334d754bf510bdf21368858d8494adf3622fb16)

M  +1    -1    plugins/clang/codegen/adaptsignatureassistant.cpp
M  +8    -0    plugins/clang/tests/test_assistants.cpp

https://commits.kde.org/kdevelop/3f99e3deefbe3b77ba023bf09b69d8da3ca815fc
Comment 5 Kevin Funk 2018-03-19 17:20:04 UTC
*** Bug 375277 has been marked as a duplicate of this bug. ***
Comment 6 Piotr Mierzwinski 2019-01-03 22:19:27 UTC
Either I found new case when constructor is broken by inserting void on its begin or this is just regression.
Initial code looks like below:

Header file (myclass.h):
public:
	MyClass();

cpp file (myclass.cpp):
MyClass::MyClass()
{
// some code
}

Steps to reproduce:
1. instead of "// some code" in definition of constructor put code like below:

   if (bParam)
      ;

2. copy to clipboard string like: "bool bParam"
3. paste copied string as parameter for constructor in cpp file. 
   After that definition will look like this:

   MyClass::MyClass( bool bParam )

4. Click on end above line, KDevelop will show two solutions, suggesting how to fix the code
5. Click into the first one and after click into the second one
6. Switch to header file

CURRENT RESULT:
public:
	void MyClass( bool bParam );

EXPECTED RESULT:
public:
	MyClass( bool bParam );