Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330123 - Rename does not rename methods with const parameters
Summary: Rename does not rename methods with const parameters
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 6.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 7.0.2   Edit
Assignee: Markus Schorn CLA
QA Contact: Emanuel Graf CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-12 12:38 EST by Marc-André Laperle CLA
Modified: 2010-11-24 04:23 EST (History)
1 user (show)

See Also:


Attachments
Test (1.96 KB, patch)
2010-11-12 13:31 EST, Marc-André Laperle CLA
mschorn.eclipse: iplog+
Details | Diff
fix (3.22 KB, patch)
2010-11-18 06:05 EST, Markus Schorn CLA
mschorn.eclipse: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-André Laperle CLA 2010-11-12 12:38:43 EST
Using CDT 8.0.0.201011111203 (hudson build #412).

TestRename.h:

#ifndef TESTRENAME_H_
#define TESTRENAME_H_

class TestRename
{
    void foo(const int bar);
};

#endif

TestRename.cpp

#include "TestRename.h"

void TestRename::foo(const int bar)
{
}

Try renaming foo, it won't change the other one. Removing the const works.
Comment 1 Marc-André Laperle CLA 2010-11-12 13:31:56 EST
Created attachment 183021 [details]
Test
Comment 2 Marc-André Laperle CLA 2010-11-12 14:09:07 EST
I can also reproduce this with 6.0 and 7.0.1.
Comment 3 Marc-André Laperle CLA 2010-11-12 18:57:58 EST
The method ASTManager.isSameType(IType t1, IType t2) returns false, it probably shouldn't. t1 is a CPPQualifierType and t2 is a CPPBasicType. Maybe a problem in the parser?
Comment 4 Markus Schorn CLA 2010-11-18 06:05:50 EST
Created attachment 183372 [details]
fix

The type comparison is correct, however the type of the IParameter binding can differ from the corresponding element in the function-type. (The 'const int' is adjusted to an 'int'). So to compare two functions, the function type has to be used.
Comment 5 Markus Schorn CLA 2010-11-18 06:07:49 EST
Fixed in 8.0 > 20101118.
Comment 6 CDT Genie CLA 2010-11-18 06:23:02 EST
*** cdt cvs genie on behalf of mschorn ***
Bug 330123: Rename refactoring and const parameters.

[*] ASTManager.java 1.25 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/rename/ASTManager.java?root=Tools_Project&r1=1.24&r2=1.25
Comment 7 Marc-André Laperle CLA 2010-11-18 12:36:26 EST
(In reply to comment #5)
> Fixed in 8.0 > 20101118.

Awesome, thanks! I think this change can be applied to 7.0.2 also? And would it be possible to add the test? It passes now with the patch applied.
Comment 8 Markus Schorn CLA 2010-11-19 04:36:16 EST
(In reply to comment #7)
> (In reply to comment #5)
> > Fixed in 8.0 > 20101118.
> Awesome, thanks! I think this change can be applied to 7.0.2 also? And would it
> be possible to add the test? It passes now with the patch applied.

Sorry, I forgot to commit your testcase. I can also port the fix to 7.0.2.
Comment 9 Markus Schorn CLA 2010-11-24 03:32:24 EST
Fixed in 7.0.2 > 20101124.