Bug 244774

Summary: Kdevelop auto-changes "this->someVar" into "this.someVar"
Product: [Applications] kdevelop Reporter: olig9
Component: Code completionAssignee: kdevelop-bugs-null
Severity: normal CC: medhefgo, olivier.jg
Priority: NOR    
Version: 4.0.0   
Target Milestone: 4.0.1   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: test case showing the problem

Description olig9 2010-07-15 18:54:06 UTC
Created attachment 49181 [details]
test case showing the problem

Version:           4.0.0 (using KDE 4.4.4) 
OS:                Linux

In certain cases, when typing "obj1 > this->mObj" Kdev will change the -> characters automatically to a dot when typing it, so it reads this.mObj . This is obviously incorrect in normal C++ code.

Looks like this only happens in very special cases. See the test case. I think it has to do with:
- obj1 being an object (if it's an int the problem doesn't appear)
- the comparison being a greater-than (if it's a <, >= or == the problem doesn't appear)

Reproducible: Always

Steps to Reproduce:
- open the attached test case file in Kdev 4
- edit the "if" line: delete it and type it again, as: "if (obj1 > this->mObj)"
- observe that the -> is automatically changed to "."

Actual Results:  
The "->" characters are replaced by a "." character

Expected Results:  
The "->" characters should stay as I typed them.

Workaround is to type "(*this).someVar" instead :-)

This happens with self-compiled Kdev 4.0.60, on RHEL 5.1.
Comment 1 Jan 2010-07-16 16:36:42 UTC
I can reproduce this with KDevelop 4.0.0 in KDE SC 4.5 RC2.
Comment 2 Olivier.jg 2011-01-15 06:35:58 UTC
Auto-close didn't work because diff was too long to be added as a comment.
This is fixed by commit 6ac597c5e862b9891665025375a5febb9cf33404.